Page 1 of 1

Datagrid row modification message

Posted: Tue Apr 16, 2013 10:02 pm
by dcpbarrington
I'm looking for a way to determine if a row in a datagrid has been modified when a user can Edit the contents.

I have a Table datagrid with a combination of Text fields and Option Menu elements in each of the columns. I created it using DGH which simplified the layout process.

I created a MODIFIED column in the datagraid that contains a flag that indicates that the row has been changed and needs to be saved to the DB.

I have also added the following handler to the datagrid table script to set the MODIFIED flag of the selected row if the contents are changed.

Code: Select all

on CloseFieldEditor pFieldEditor
   dispatch "SetDataOfIndex" to group "StepTable" \
         with the dgHilitedIndex of group "StepTable", "Modified", "True"
   pass CloseFieldEditor 
end CloseFieldEditor
This handler works great when ever a Text field is modified, but does not identify if a Option Menu has been changed. I tried to add a script to the Option Menu object, but could not access the script from DGH.

Is there a message or a script that can be added to capture when the Option Menu value has been changed.

Thanks in advance for the help.

Re: Datagrid row modification message

Posted: Tue Apr 16, 2013 10:57 pm
by snm
You can monitor messages sent in the Message Viewer in LC UI.

Marek

Re: Datagrid row modification message

Posted: Tue Apr 16, 2013 11:29 pm
by dcpbarrington
The message "menuPick" is generated, but if I put a message handler in the datagrid script on the card it is never called. The message must be getting caught earlier by the datagrid. The question is where does this need to go so it is properly executed?

Code: Select all

on menuPick
   dispatch "SetDataOfIndex" to group "StepTable" \
         with the dgHilitedIndex of group "StepTable", "Modified", "True"
   pass MenuPick
end menuPick

Re: Datagrid row modification message

Posted: Wed Apr 17, 2013 4:13 pm
by dcpbarrington
Found where the datagrid puts the menuPick handler.

A behavior button is created for each column by DGH. In each of the behavior buttons is the menuPick handler. Here is what I added to make it set the modified flag.

Code: Select all

on menuPick pTheMenuItem
   switch the short name of the target
      case "TitleButton"
         SetDataOfIndex the dgIndex of me, the dgColumn of me, pTheMenuItem
         SetDataOfIndex the dgIndex of me, "Modified", "True"
         RefreshIndex the dgIndex of me
         break
   end switch
end menuPick