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

Home » Public Forums » archive » Re: state = WIDGET_INFO( button, /BUTTON_SELECT )
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
Re: state = WIDGET_INFO( button, /BUTTON_SELECT ) [message #10485] Thu, 11 December 1997 00:00
Alex Schuster is currently offline  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
Re: state = WIDGET_INFO( button, /BUTTON_SELECT ) [message #10490 is a reply to message #10485] Wed, 10 December 1997 00:00 Go to previous message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
Alex Schuster wrote:
>
> Hi!
>
> WIDGET_INFO does not know this keyword. I think it should, what about
> you? As I see it there is no possibility to find out whether a
> nonexclusive button is selected or not.
>
> Okay, this is not really a problem. I either use CW_BGROUP, or I assign
> an event handler, and whenever the button is pressed / released, I store
> event.select in the widget's uvalue. But shouldn't this be done easier?

If you don't want to use CW_BGROUP and widget_control, GET_VALUE=,
it's probably easier to just maintain toggle flags for the state of
each button, and update the flags in your event handler. I usually
use these flags for other purposes anyway.

> And did anyone yet need WIDGET_CONTROL, GET_VALUE to get the _text_ of a
> button?

Uh, no. Usually the program already knows what the buttons say!

>
> Or am I, as so often, just missing something?
>

No, just complaining. ;-)

Dave
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
Re: state = WIDGET_INFO( button, /BUTTON_SELECT ) [message #10492 is a reply to message #10490] Wed, 10 December 1997 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Alex Schuster (alex@rosa.mpin-koeln.mpg.de) writes:

> 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.

> 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. :-)

Cheers,

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Plug-in for triangulate
Next Topic: Placement of Floating widgets

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

Current Time: Wed Oct 08 17:08:39 PDT 2025

Total time taken to generate the page: 0.00703 seconds