[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

widget_table bug?



I'm having problems with widget_table.  On a single character insertion
(event.type = 0), I believe the event.offset is not always correct.  Run
the test procedure in the example code (below).  It creates a
widget_table in a widget_base.  Whenever a widget_table event is
generated, the program dumps (help,/struct) the event.

When you run it you'll notice the string 123 has been placed in the
upper left cell.   Double-click on this cell to put it into edit mode
and move the insertion point  to just after the 3. Press the 4 key.
Observe that the event.offset value is 2 for the character insertion
event (type=0).  Shouldn't it be 3?  Now, delete the 4 and move the
insertion point to between the 2 and 3.  Press the 4 key. Note the
event.offset is 2.  How the heck am I supposed to tell the difference
between the user inserting a character at these two locations????

Particulars

IDL> print,!version
{ x86 Win32 Windows 5.2 Oct 30 1998

Am I missing something or is this a bug?

Ray
rfm2@po.cwru.edu



test,pro -----------------------------------
pro dataEntry, event

print,'Event type: ',event.type

help,/struct,event


return
end


pro test

nr = 3
rl = strarr(nr)
for i=1,nr do begin
  rl(i-1) = string(i, format='(i4)')
endfor
cl = ['C1', 'C2', 'C3', 'C4', 'C5']
nc = n_elements(cl)

v=strarr(nc,nr)
v(0,0)='123'
device, GET_SCREEN_SIZE=scrsiz
b = widget_base(/column)
t = widget_table(b, $
     value = v, $
     xsize = n_elements(cl), ysize = nr, $
     x_scroll_size = 5,  $
     y_scroll_size = 10,  $
     column_labels = cl, $
     column_widths = [ 75, 100, 100, 100, 100], $
     row_labels = rl, $
     /editable, /all_events, event_pro='dataEntry')


widget_control, b, /realize
xmanager,'test', b


return
end


Sent via Deja.com http://www.deja.com/
Before you buy.