quit/close events on mac [message #70876] |
Thu, 13 May 2010 23:39 |
Stewart Allen
Messages: 3 Registered: May 2010
|
Junior Member |
|
|
Hi all,
I'm running IDL 7.0 on a mac under leopard 10.5.8. I'm trying to
create a widget program, but I can't seem to get the window manager to
respond to quit events. Specifically, the window's default 'quit'
button is unresponsive to events.
For example consider the following simple code that creates a single
'done' button, along with event handlers
-----------------------------
; event handler for done button widget
PRO example_event, ev
help,/traceback
WIDGET_CONTROL, ev.top, /DESTROY
END
; dummy cleanup routine with a print statement so we know we are in
it.
PRO example_cleanup, base
help,/traceback
print,'cleaning: ',base
END
; End of the event handler part:
; This is the routine that creates the widget and registers it with
; the XMANAGER:
PRO example
; Create the top-level base for the widget:
base = WIDGET_BASE(TITLE='Example')
; Create a nice BIG Done button:
done = WIDGET_BUTTON(base, VALUE = 'Done',xsize=200,ysize=50)
; Realize the widget (i.e., display it on screen):
WIDGET_CONTROL, base, /REALIZE
; Register the widget with the XMANAGER, leaving the IDL command
; line active:
XMANAGER, 'example', base $
, cleanup='example_cleanup' $
, /NO_BLOCK
; End of the widget creation part:
END
-----------------------------
If I run example, it creates the widget correctly. Then, if I click
the done button, it calls the event handler, which in turn calls the
cleanup handler - as I expect. However, if I click the window's 'quit'
button (i.e. the default window quit button next to the minimize and
maximize buttons), the cleanup handler is not triggered... but I can't
understand why not!
If I run this code on a linux box, with X-forwarding back to my mac,
the quit button works as it should... This has me well puzzled.
|
|
|