update URL when user changes the value of a cell

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
ittarter
Posts: 151
Joined: Sat Jun 13, 2015 2:13 pm

update URL when user changes the value of a cell

Post by ittarter » Thu Sep 03, 2015 4:36 pm

In a basic table or datagrid, how would I get the program to response when a user changes the value of a cell, in such a way that the program knows which cell is being changed and can act accordingly (e.g. copy the changes to a URL)?

I'm envisioning the following scenarios. After changing the cell's value, the user:

-- tabs into another cell
-- presses the 'return' key
-- clicks anywhere in the app but outside the boundaries of the table/grid
-- clicks another cell
-- presses the 'up' 'down' 'left' 'right' key

Some of these I think I know (e.g. on keyDown up), but I don't know how livecode distinguishes between different cells in a way where I could get my program to know which item/line to validate/update.

Thanks :D

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: update URL when user changes the value of a cell

Post by Klaus » Thu Sep 03, 2015 4:52 pm

Hi ittarter,

check the chapter "Using The Built-In Field Editor" in the datagrid docs!
A topic I could avoid so far! :D

Get the datagrid PDF here: http://lessons.runrev.com/m/datagrid


Best

Klaus

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: update URL when user changes the value of a cell

Post by sritcp » Thu Sep 03, 2015 6:58 pm

Hi ittarter:

Put the following code into your datagrid script:

Code: Select all

on closeFieldEditor pFEditor 
 local tCol, tRowIndex
   put  the dgColumn of the target into tCol # name of column edited
   put the dgIndex of the target into tRowIndex #gives the dgIndex of the edited row
  # now do whatever you want with these data
end closeFieldEditor
Pressing tab, return, etc., etc., will close the editor and call this handler.
This will only work with datagrid table, not form.

Regards,
Sri

ittarter
Posts: 151
Joined: Sat Jun 13, 2015 2:13 pm

Re: update URL when user changes the value of a cell

Post by ittarter » Fri Sep 04, 2015 10:12 am

Very helpful, thanks guys :D

Post Reply