Datagrid not displaying entries before clicked item on redraw

Trevor DeVore lists at mangomultimedia.com
Sat Aug 30 16:27:12 EDT 2014


On Saturday, August 30, 2014, Dr. Hawkins <dochawk at gmail.com> wrote:

> I'm using a datagrid, and my template has a checkfield (a field with code
> to act like a checkbox).
>
> Once I click on an item, it does a bit of processing, and eventually gets
> to a line where it
>
>    set the dgData of grp "dnaDisp" to theData
>
> for any changed data.
>
> ...
>
>
> Does anyone have any idea what could be going on?
>

Don't redraw the data grid while handling an event in a row control. You
are setting the dgData which redraws the entire data grid. The engine
doesn't like it when you delete the control that is executing a script so
this is likely the cause of the error.

2 options -

1) Place all of the code that is triggered when the checkbox is clicked in
the data grid group. This moves code execution out of the row control and
into the group itself. I'm guessing you will have a mouseUp that checks the
target and does something if the checkbox is clicked.

2) In the checkbox code use send in time to call the code that the checkbox
should trigger. The code that sets the dgData becomes a handler in the data
grid group. The checkbox mouseUp code triggers that handler in time so that
the checkbox is no longer executing a script if it happens to be deleted.



More information about the use-livecode mailing list