DataGrids with no UI

Todd Geist todd at geistinteractive.com
Wed Sep 26 21:28:45 EDT 2012


On Sep 26, 2012, at 4:10 PM, Monte Goulding <monte at sweattechnologies.com> wrote:
> If you work out how to get a library to listen to changes in a datagrid (which you will need to do if you want to bind it to a table) then could you post it on the list. I have a custom control (mergDataGridScroller) that needs to know when the data is changed. At the moment it requires you to dispatch updateContentRect to it after changing the datagrid data but if it could listen to changes it would be nicer. I can't se anything in the api that helps me with that though.


One thing to note…. I drive the population of the grid from the DB.  When changes occur to the DB, and if a grid needs to be updated it is updated.  If I need to update a row in the Grid with a script, I update the DB, that in turn updates the correct row in the Grid.  Therefor the only changes that I need to listen for on the grid are user edits.  I *think* i can get what I want with this.

on CloseFieldEditor
   put the dgControl of the target into theGrid
   send "DataGridEdited theGrid" to me in 1 millisecond
end CloseFieldEditor

on DataGridEdited theGrid
   -- grab the data and store it.
   -- since I have a reference to the grid I can get its data.
end DataGridEdited


Or this is where I am at so far….

The "send" to me in 1 millisecond is key.  Since that is what allows the Field editor to close.

I think I will be able to get what I need from the grids to automatically save the data, but I don't think it is going to help you, Monte :-(.  You probably need a message on any change to the data in a grid regardless of how it is made.  I only care about user edits.


Todd

--
Todd Geist
------------------------------------
http://www.geistinteractive.com
805-419-9382



More information about the use-livecode mailing list