Cross platform Widget_Table [message #38188] |
Tue, 24 February 2004 14:12 |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
Hello,
I have been skittering around all day with widget tables. It's quite a
(re)learning curve everytime I use 'em.
I have set up the program to "autosave" every time the user changes the
contents of a field. So, I have set up the table with EDITABLE = 1 and
ALL_EVENTS = 0 (events for end-of-line insertion only). This is the
behavior I desire and it works fine... but, I wonder if the end-of-line
insertion is the same on all platforms.
Here's a little example on a Mac OSX...
(1) User edits a value and hits <return>
this generates 2 "WIDGET_TABLE_CH" events, the first has ev.CH = 10B
and the second has ev.CH = 13B
(2) User edits a value and hits the keyboard up-arrow or down-arrow
this generates a single "WIDGET_TABLE_CH" event with ev.CH = 13B
(3) User edits a value and hits the keyboard <tab> or <shift-tab>
this generates a single "WIDGET_TABLE_CH" event with ev.CH = 13B
I have been assuming that I can simply look for ev.CH = 13B before doing
my "AutoSave" thing. But then I read the "String Composition" thread of
this week.
Are these the end-of-line insertion events same on other systems? I
have pasted simple test code below if your willing to test it.
Thanks!
Ben
*******START CODE
PRO table_widget_example3_quit_event, ev
Widget_Control, ev.top, /destroy
END
PRO table_widget_example3_table_event, ev
If Tag_Names(ev, /structure_name) EQ "WIDGET_TABLE_CH" Then Begin
Print, 'EditEvent: ', ev.CH
ENDIF
END
; Widget creation routine.
PRO table_widget_example3
data = Lindgen(4,5)
base = WIDGET_BASE(/COLUMN)
table = WIDGET_TABLE(base, VALUE=data, $
Editable = 1, $
Event_Pro= 'table_widget_example3_table_event')
b_quit = WIDGET_BUTTON(base, VALUE='Quit', $
EVENT_PRO='table_widget_example3_quit_event')
WIDGET_CONTROL, base, /REALIZE
XMANAGER, 'table_widget_example3', base
END
********END CODE
|
|
|