I have a mousedown handler in the last column (deleteright) behavior script. The script is supposed to delete the data from a database, clear the datagrid and repopulate. Im trying to clear the datagrid with the ResetControl command but it works in some respects and not others. It will clear everything with the empty and update buttons at the top but when I call it from the mousedown handler in my column behavior script the datagrid does not clear that column, which then wont repopulate. I uploaded the stack to revOnline under Paul D if anyone can take a look at it.
Datagrid not clearing with ResetControl
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Datagrid not clearing with ResetControl
Im striking out on these datagrids....
I have a mousedown handler in the last column (deleteright) behavior script. The script is supposed to delete the data from a database, clear the datagrid and repopulate. Im trying to clear the datagrid with the ResetControl command but it works in some respects and not others. It will clear everything with the empty and update buttons at the top but when I call it from the mousedown handler in my column behavior script the datagrid does not clear that column, which then wont repopulate. I uploaded the stack to revOnline under Paul D if anyone can take a look at it.
I have a mousedown handler in the last column (deleteright) behavior script. The script is supposed to delete the data from a database, clear the datagrid and repopulate. Im trying to clear the datagrid with the ResetControl command but it works in some respects and not others. It will clear everything with the empty and update buttons at the top but when I call it from the mousedown handler in my column behavior script the datagrid does not clear that column, which then wont repopulate. I uploaded the stack to revOnline under Paul D if anyone can take a look at it.
-
trevordevore
- VIP Livecode Opensource Backer

- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Contact:
It looks like you are running into trouble because you are trying to redraw the data grid from code that is running inside one of the data grid controls.
Basically your deleteright column behavior is executing at the time when the data grid is trying to delete the control. If you want to redraw the data grid you can use send in time or move the code to the data grid itself. The lesson on how to avoid needless suffering talks about this:
http://revolution.screenstepslive.com/s ... Suffering-
Here is what your code looks like using send in time:
This replaces the current code in the behavior:
Basically your deleteright column behavior is executing at the time when the data grid is trying to delete the control. If you want to redraw the data grid you can use send in time or move the code to the data grid itself. The lesson on how to avoid needless suffering talks about this:
http://revolution.screenstepslive.com/s ... Suffering-
Here is what your code looks like using send in time:
Code: Select all
put "recon_right" into theParam1
put theData["rightid"] into theParam2
send "deletefromdatabase theParam1, theParam2" to the dgControl of me in 0 seconds
Code: Select all
deletefromdatabase "recon_right", theData["rightid"]
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder