Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Saving tablelist to file via editendcommand

73 views
Skip to first unread message

asilver

unread,
Jun 13, 2012, 2:21:28 PM6/13/12
to
My question is with editendcommand. I’m using this option for editing
a cell with a checkbox in it. If the user changes/toggles the
checkbutton box, I would like to immediately save the contents of the
tablelist file as soon as the user moves the cursor out of that cell.
I wanted to do this with the call to the editendcommand. The problem
is the editendcommand does not write the changed value of the checkbox
to the contents of the tablelist until the procedure is finished. Is
there a recommended simple way to do this? I guess I could add
another button in the window to “save to file” but I didn’t really
want to do that. Any suggestions for tips would be appreciated.

Thank you.

Al Silverstein

nemethi

unread,
Jun 13, 2012, 4:34:29 PM6/13/12
to
Am 13.06.2012 20:21, schrieb asilver:
> My question is with editendcommand. I�m using this option for editing
> a cell with a checkbox in it. If the user changes/toggles the
> checkbutton box, I would like to immediately save the contents of the
> tablelist file as soon as the user moves the cursor out of that cell.
> I wanted to do this with the call to the editendcommand. The problem
> is the editendcommand does not write the changed value of the checkbox
> to the contents of the tablelist until the procedure is finished. Is
> there a recommended simple way to do this? I guess I could add
> another button in the window to �save to file� but I didn�t really
> want to do that. Any suggestions for tips would be appreciated.
>
> Thank you.
>
> Al Silverstein

It is true that the internal value of the cell being edited won't be
updated before the editing is finished. This is the intended and
documented behavior. From this it follows that saving the tablelist
widget's contents *directly* from within the editendcommand is not the
right solution. On the other hand, you can use the editendcommand to
*schedule* your save script for delayed execution via "after idle" or
"after 1", or even "after 0". By the time the save script is invoked,
the editing session is already finished, and thus the tablelist's
internal content is up-to-date.

--
Csaba Nemethi http://www.nemethi.de mailto:csaba....@t-online.de

asilver

unread,
Jun 13, 2012, 8:34:09 PM6/13/12
to
Great, thanks for the tip, I got that working. The last problem I seem to be having is if the user changes the checkbox cell and then hits the Ok button to exit my window without unselected that edited cell. In this case the editendcommand is never executed and the cell never gets updated. Any suggestions?

Thank you.

nemethi

unread,
Jun 14, 2012, 3:47:56 PM6/14/12
to
The easiest way to solve this problem is to invoke the finishediting
subcommand, followed by an invocation of your save script, both from
within the command associated with the Ok button.
0 new messages