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

Home » Public Forums » archive » Re: Getting checkbox value
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: Getting checkbox value [message #28734] Wed, 09 January 2002 08:18 Go to next message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
Oh boy.
I think explicit placement of sarcasm and irony signs is the must do on a
comp.lang group :(
Repeating:
*Think of the space savings - you can store state of some 64 checkboxes ;-)
*
Besides, code does not take up any room. To me, my method was convenient -
one-line setting and getting of any checkbox state, anywhere in the code :)
Pavel

"Marc Schellens" <m_schellens@hotmail.com> wrote in message
news:3C3C9A61.B4CE046B@hotmail.com...
> "Pavel A. Romashkin" wrote:
>> Think of the space savings - you can store state of some 64 checkboxes
>> in just 8 bytes!
>> Pavel
>
> Actually I doubt that this is a good idea.
> Especailly in IDL.
> If you have megabytes of data, ok, but just for
> checkboxes, the code you add to the running
> program is *much* larger that the few bytes you saved.
> (Unless you have thousands of checkboxes).
Re: Getting checkbox value [message #28743 is a reply to message #28734] Wed, 09 January 2002 00:13 Go to previous messageGo to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Lisa Gandy wrote:
>
> I am trying to get the value of a checkbox...meaning I would like to
> know if the checkbox is selected at a certain time. I have looked
> through the references under widget_control and widget_info but
> neither of these keywords seem to return if a checkbox button has been
> selected or not. Did I overlook something?
>
> Cheers,
> Lisa Gandy

I have written a compound widget cw_buttons to manage this and some
other
button functions.


http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/cw_buttons.tar.gz

Here is a small example

PRO xtest_event,ev
WIDGET_CONTROL,ev.id, get_uval=cmd
CASE cmd OF
'TEST': BEGIN
WIDGET_CONTROL,ev.id,get_value=v
HELP,v,/str
idx=WHERE(v.set EQ 1,count)
IF count GT 0 THEN PRINT,v.value[idx]
END

'DONE': WIDGET_CONTROL,ev.top,/destroy
ELSE :
ENDCASE

END


PRO xtest
a=WIDGET_BASE(row=2)
value={value:['LOG','ALOG','SIN'],set:[0,0,1]}
b=cw_buttons(a,value=value,uvalue='TEST',col=2, $
/exclusive,frame=2,xoffset=20,yoffset=0,button_frame=1)
b=WIDGET_BUTTON(a,value='DONE',uvalue='DONE')


WIDGET_CONTROL,/realize,a
XMANAGER,'xtest',a
END


regards

Reimar


--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html

http://www.fz-juelich.de/zb/text/publikation/juel3786.html
============================================================ ======

read something about linux / windows
http://www.suse.de/de/news/hotnews/MS.html
Re: Getting checkbox value [message #28746 is a reply to message #28743] Wed, 09 January 2002 11:30 Go to previous messageGo to next message
marc schellens[1] is currently offline  marc schellens[1]
Messages: 183
Registered: January 2000
Senior Member
"Pavel A. Romashkin" wrote:
>
> I had a case when I kept on adding checkboxes a few times while
> developing a program. I didn't want to go and change the State structure
> all the time, so I wrote a small program called CHECKBOX. You can find
> it here:
> http://spot.colorado.edu/~romashki/idl/checkbox.pro
> All you need is to set up a long integer somewhere (be it State
> structure or Uvalue of one of the widgets already referred to in State
> structure, for easy retrieving). Then, in the event code for the
> checkbox, you call the CHECKBOX with event.select as ACTION keyword argument.
> CHECKBOX program then will set an appropriate bit of the Long you
> created, and the state of that bit is the same as the state of that
> checkbox. Later, you can call
> status = checkbox(Long_var, bit_number, /get)
> and get status of checkbox.
> Think of the space savings - you can store state of some 64 checkboxes
> in just 8 bytes!
> Pavel

Actually I doubt that this is a good idea.
Especailly in IDL.
If you have megabytes of data, ok, but just for
checkboxes, the code you add to the running
program is *much* larger that the few bytes you saved.
(Unless you have thousands of checkboxes).

To Lisa:
if you create your checkbox with
id=cw_bgroup(tlb,['b1','b2'...],/NONEXCLUSIVE)
you can get the status of the buttons anytime with
widget_control,id,GET_VALUE=arr
where arr is an intarr set to 1 for every selected button, 0 for
nonselected.

cheers,
marc
Re: Getting checkbox value [message #28750 is a reply to message #28743] Tue, 08 January 2002 13:02 Go to previous messageGo to next message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
I had a case when I kept on adding checkboxes a few times while
developing a program. I didn't want to go and change the State structure
all the time, so I wrote a small program called CHECKBOX. You can find
it here:
http://spot.colorado.edu/~romashki/idl/checkbox.pro
All you need is to set up a long integer somewhere (be it State
structure or Uvalue of one of the widgets already referred to in State
structure, for easy retrieving). Then, in the event code for the
checkbox, you call the CHECKBOX with event.select as ACTION keyword argument.
CHECKBOX program then will set an appropriate bit of the Long you
created, and the state of that bit is the same as the state of that
checkbox. Later, you can call
status = checkbox(Long_var, bit_number, /get)
and get status of checkbox.
Think of the space savings - you can store state of some 64 checkboxes
in just 8 bytes!
Pavel

Lisa Gandy wrote:
>
> I am trying to get the value of a checkbox...meaning I would like to
> know if the checkbox is selected at a certain time. I have looked
> through the references under widget_control and widget_info but
> neither of these keywords seem to return if a checkbox button has been
> selected or not. Did I overlook something?
>
> Cheers,
> Lisa Gandy
Re: Getting checkbox value [message #28755 is a reply to message #28750] Tue, 08 January 2002 10:34 Go to previous messageGo to next message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
Lisa Gandy wrote:
>
> I am trying to get the value of a checkbox...meaning I would like to
> know if the checkbox is selected at a certain time. I have looked
> through the references under widget_control and widget_info but
> neither of these keywords seem to return if a checkbox button has been
> selected or not. Did I overlook something?

I usually do this by setting a "selected" field in my widget info structure when the
checkbox/radio button is set/unset. Then if I want to know the value at some arbitrary time
(not relying on an event, say) I just check the corresponding value of the info structure. If
you have a whole bunch of (nonexclusive) buttons any of which may or may not be set at any
time, use an array to store the "select" status of each one (e.g. 0=unset, 1=set or whatever).
Then it's easy to find which buttons are set (or not) using a WHERE on the select status array,
the index result of which you can then apply to the button id array (which I also save in the
info structure) if you, say, wanted to clear or set all the checkboxes/buttons.

Simple minded, but it works pretty well.

paulv

--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
sorry [message #28818 is a reply to message #28734] Thu, 10 January 2002 12:52 Go to previous message
marc schellens[1] is currently offline  marc schellens[1]
Messages: 183
Registered: January 2000
Senior Member
> Oh boy.
> I think explicit placement of sarcasm and irony signs is the must do on a
> comp.lang group :(
> Repeating:
> *Think of the space savings - you can store state of some 64 checkboxes ;-)
> *
> Besides, code does not take up any room. To me, my method was convenient -
> one-line setting and getting of any checkbox state, anywhere in the code :)

Oh, got me.
First I thought you were sarcastic. But when I looked then at your
actual
program (with all the comment) I thought: Well nobody would spent so
much effort
just for sake of sarkasm - well, was wrong.

But since when does code not occupy space (=computer memory)???

ashamed,
:-) marc
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: RGB image
Next Topic: object widgets

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

Current Time: Wed Oct 08 13:53:23 PDT 2025

Total time taken to generate the page: 0.01114 seconds