Re: Linking buttons to plot windows [message #42056] |
Mon, 20 December 2004 14:11  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Clive Cook writes:
> Thanks David, i'm pretty new to widget programming so i am not really sure
> what to do. This is an example of the code that the GUIbuilder generates. I
> assume that the first part of the code (WID_BASE_0_event) handles the
> events, so when i press wid_button_1 the function contour1 is called. As i
> mentioned before this plots in the last area designated for plots
> (wid_draw_1). How can i specifically plot it in the first area (wid_draw_0)?
It is my humble (and mostly ignored) opinion that it
is *impossible* to use the GUI_BUILDER to create widget
programs. At least programs you can understand. And this
code is like running your fingernails across the blackboard
to me. But, your code will look something like this (assuming
the CONTOUR event handlers aren't doing something weird):
pro WID_BASE_0_event, Event
wWidget = Event.top
case Event.id of
Widget_Info(wWidget, FIND_BY_UNAME='wid_button_0'): begin
if( Tag_Names(Event, /STRUCTURE_NAME) eq 'WIDGET_BUTTON' )then $
BEGIN
drawID = WIDGET_INFO(wWidget, FIND_BY_UNAME='WID_DRAW_O')
Widget_Control, drawID, Get_Value=wid
WSET, wid
contour1, Event
ENDIF
end
Widget_Info(wWidget, FIND_BY_UNAME='WID_BUTTON_1'): begin
if( Tag_Names(Event, /STRUCTURE_NAME) eq 'WIDGET_BUTTON' )then $
BEGIN
drawID = WIDGET_INFO(wWidget, FIND_BY_UNAME='WID_DRAW_1')
Widget_Control, drawID, Get_Value=wid
WSET, wid
contour2, Event
ENDIF
end
else:
endcase
end
If that is not the ugliest code I've ever posted in a newsgroup,
I don't know what is. :-(
Cheers,
David
P.S. Really do yourself a favor and ditch the GUI_BUILDER. You
(and your boss) will be glad you did. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|