Re: Getting checkbox value [message #28734] |
Wed, 09 January 2002 08:18  |
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   |
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   |
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   |
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
|
|
|
|
sorry [message #28818 is a reply to message #28734] |
Thu, 10 January 2002 12:52  |
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
|
|
|