SOLVED:setting focus and editing field programmatically

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 365
Joined: Mon Jun 10, 2013 1:32 pm

SOLVED:setting focus and editing field programmatically

Post by Lagi Pittas » Mon Jan 19, 2015 8:38 pm

Hi

I am working on custom column behaviours in a grid.

What I want to do (to start with) is to programmatically focus on a specific column and in effect "double click" to start editing

I am using all forms of the focus on command but is not working even just to focus on the grid itself

for example

focus on group "grid1" of this card

focus on "field "date" of group "grid1" of this card

the first one gives no error but does nothing. The second one says there is no such object

specifically button "focus": execution error at line 3 (Chunk: no such object), char 1



KIndest Regards Lagi
Last edited by Lagi Pittas on Tue Jan 20, 2015 12:56 pm, edited 1 time in total.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: setting focus and editing field programmatically

Post by Simon » Mon Jan 19, 2015 9:32 pm

Hi Lagi Pittas,
You have an errant quote in front of field
Bad
focus on "field "date" of group "grid1" of this card
Good
focus on field "date" of group "grid1" of this card

Not clear on the other stuff you would like.

Simon
Edit; OK so it is a datagrid. Check out EditFieldText in the Data Grid API.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 365
Joined: Mon Jun 10, 2013 1:32 pm

Re: setting focus and editing field programmatically

Post by Lagi Pittas » Tue Jan 20, 2015 1:01 am

Hi Simon

Thanks for the reply

The second line is like you said, I just mistyped in my post Ibshoukd have cut and pasted

Both lines give no errors when I press apply

The second only gives the error when executing the line.

I was hoping if I could get the focus workingb then I could at least send a double click message to star editing automatically

Lagi

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 365
Joined: Mon Jun 10, 2013 1:32 pm

SOLVED: setting focus and editing field programmatically

Post by Lagi Pittas » Tue Jan 20, 2015 12:45 pm

HI

I suppose it's RTFM (Read The Fine Manual) time - seems the Datagrid being a group can't get focus
so we have to use :

set the dgFocus of group "grid1" to true|false

Now I have been trying to do the next part of opening up the cell for editing WITHOUT needing to double click.
Infact what I wanted to do was open the first cell for editing when the grid gets focus but I have settled for the easier route.

I changed the MouseDoubleUp to mouseup for each column behavior and it does what I need - but it has been a real pain for something so simple

Regards Lagi

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”