Re: How to use widget button as equivalent for keyword selector [message #74173] |
Tue, 04 January 2011 06:07 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
rut writes:
> somewhat more specific-hopefully: when response to pressing widget
> buttons is organized in a 'case of structure',
> how can I make the result of pressing one button dependent on whether
> or not another button has been pressed.
> Should it involve a common block and if so, how?
A common block. In an widget program!? No, definitely
no. Who have you been talking to? We want this person's
name so we can revoke their IEPA credentials. :-)
Widget programs use a state or info structure to
store *all* of the information you need to run
your program, including flags that tell you want
did or didn't already happen in the program. The
info structure is often stored in a pointer and
the pointer reference is passed around to all
the event handlers and other routines that need it,
typically by storing the pointer reference in the
user value of the top-level base widget, where it
is easily accessible.
See, ... well, nearly any widget program ever written.
Except those of your colleague, apparently. :-)
Here is one that is pretty basic, although the
info structure is not stored in a pointer, in this
case, since pointers weren't invented yet when this
program was first written. But it will give you the
idea:
http://www.dfanning.com/programs/fsc_zimage.pro
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|