comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » draw widget in separate window does not create events?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
draw widget in separate window does not create events? [message #61316] Thu, 10 July 2008 16:17
Alfred de Wijn is currently offline  Alfred de Wijn
Messages: 2
Registered: July 2008
Junior Member
Hi everyone,

I'm running into an issue with draw widgets. I want to have two
windows, one with controls, and a second one with the draw widget.
The controls should respond to motion and button events in the draw
widget. It works fine as long as I put the draw widget in the same
window as the controls, but as soon as I split them, it seems that no
events are created. It must be possible to get this to work. I
haven't been able to find anything indicating that someone else ran
into this problem before.

I've included some code below that exhibits the problem using IDL 7.0
on OS X, IDL 6.4 on Linux, and IDL 6.3 on Windows. I suspect
programming error on my part, but then I have a report from David
Fanning that it does work as expected on his Windows system. Using
the code below, the sliders do not move if I move my cursor around in
the draw widget if it is in a separate window ('test'), but it does
work if the sliders and the widget are in the same window ('test, /
one'). Does anyone know what is causing this behavior?

Thanks,
Alfred

pro test_x_slider, event
widget_control, event.top, get_uvalue = info
(*info).x = event.value
end

pro test_y_slider, event
widget_control, event.top, get_uvalue = info
(*info).y = event.value
end

pro test_destroy, event
widget_control, event.top, /destroy
end

pro test_mouse, event
widget_control, event.top, get_uvalue = info

if event.type eq 2 then begin
widget_control, (*info).x_slider, set_value = event.x
widget_control, (*info).y_slider, set_value = event.y
endif
end

pro test, one = one
xsize = 256
ysize = 256

root = widget_base(title = 'test', /column)
x_slider = widget_slider(root, title = 'X position', $
minimum = 0, maximum = xsize-1, value = 0)
y_slider = widget_slider(root, title = 'Y position', $
minimum = 0, maximum = ysize-1, value = 0)
closebutton = widget_button(root, value='close', $
event_pro = 'test_destroy')
widget_control, root, /realize

info = { x_slider:x_slider, y_slider:y_slider }
info = ptr_new(info, /no_copy)
widget_control, root, set_uvalue=info

if keyword_set(one) then begin
drawroot = root
endif else begin
drawroot = widget_base(title = 'test draw', group_leader = root)
widget_control, drawroot, set_uvalue = info
widget_control, drawroot, /realize
endelse
draw = widget_draw(drawroot, xsize = xsize, ysize = ysize)
widget_control, draw, get_value = drawwid
wset, drawwid
widget_control, draw, event_pro = 'test_mouse', $
/draw_motion_events, /sensitive

xmanager, 'test', root, /no_block
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Where, exactly, do DLL files need to be?
Next Topic: Help! IDL 7.0 crashes in Fedora 9

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:56:01 PDT 2025

Total time taken to generate the page: 0.00663 seconds