Re: state = WIDGET_INFO( button, /BUTTON_SELECT ) [message #10485] |
Thu, 11 December 1997 00:00  |
Alex Schuster
Messages: 124 Registered: February 1997
|
Senior Member |
|
|
David Fanning wrote:
>> WIDGET_INFO does not know this keyword. I think it should,
>> what about you?
>
> I agree. Have you asked the nice folks at RSI to add it?
> They usually follow through on reasonable requests like this.
They'll get a copy of the posting.
>> And did anyone yet need WIDGET_CONTROL, GET_VALUE to
>> get the _text_ of a button? Or am I, as so often,
>> just missing something?
>
> Hum, that is how I almost *always* find out which button
> caused the event. I like to branch in my case statement
> on something I can read that makes sense to me. But then,
> I'm usually missing something too. :-)
Yikes! I change the texts on my buttons way too often for that...
In my programs, every button gets assigned its own event handling
routine.
While I was at it, I wrote a small procedure:
pro button_state_event, event
widget_control, event.id, get_uvalue=uvalue, /no_copy
uvalue.state = event.select
widget_control, event.id, set_uvalue=uvalue, /no_copy
end
I create my buttons like this:
state = 1
button = widget_button( base, event_pro='button_state_event', $
uvalue={ state:state }, value='A Button' )
widget_control, button, set_button=state
When I need the value later, I just look at the uvalue.
Alex
--
Alex Schuster Wonko@weird.cologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de
|
|
|