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

Home » Public Forums » archive » sec : U Re: problem with checkbox in cw_form
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
sec : U Re: problem with checkbox in cw_form [message #34875] Mon, 28 April 2003 20:56 Go to next message
Andrew Cool is currently offline  Andrew Cool
Messages: 219
Registered: January 1996
Senior Member
Sergey Koposov wrote:
>
> Hello!
> Because, this widget is used in very complicated program, and it would
> be nice if the values of some parameters entered by user were obtained
> with single cw_form (it is more simple to get the states of fields with
> using cw_form then standart widget construction).
> Moreover, I don't believe that it is impossible to make a single
> checkbox in cw_form. It would be very strange , I think. :)
> Cheers,
> Sergey K
>
> Pavel Romashkin wrote:
>> Why not create the single checkbox in a separate exclusive base, not as
>> part of cw_form?
>>
>> Cheers,
>> Pavel
>>
>> "�x���" wrote:
>>
>>> Can somebody tell me how to create only one checkbox in the cw_form. I dont
>>> how to do this, because , by default, if there is only one item in the
>>> initial value field (in the parameters of cw_form) IDL create a simple
>>> button, but no the checkbox.
>>> Thanks,
>>> Sergey Koposov


Sergey,

CW_FORM is available as a .PRO file in your IDL disribution,
e.g. look for C:\RSI\IDL56\LIB\CW_FORM.PRO.

CW_FORM.PRO is hardwired to produce single "standard" button if
you only supply 1 value.

But there's no reason why you can't take a copy of RSI's CW_FORM.PRO
and put it into your own IDL path, preferably sensibly renamed.

Below I've take a brute force approach and just copied the code for
multiple buttons into the area for a singel button. It works nicely,
producing a single checked button.

You might wish to make a more sensitive amendment to the code ;-)

Cheers,

Andrew


'BUTTON': BEGIN
CW_FORM_APPEND, extra, e, 'LABEL_LEFT', /USE_VALUE
CW_FORM_APPEND, extra, e, 'LABEL_TOP', /USE_VALUE
exclusive = CW_FORM_PARSE(e,'EXCLUSIVE')
no_release = CW_FORM_PARSE(e,'NO_RELEASE')
values = strtok(a[2],'|', /EXTRACT, ESC='\')

if n_elements(values) ge 2 then begin
type = 0
if CW_FORM_PARSE(e, 'SET_VALUE', temp) then begin
result = execute('sval=fix('+temp+')')
new = CW_BGROUP(parent, strtok(a[2],'|',/EXTRACT), $
EXCLUSIVE = exclusive, NONEXCLUSIVE = 1-exclusive, $
FRAME=frame, NO_RELEASE = no_release, $
SET_VALUE = sval, _EXTRA=extra)
endif else begin
new = CW_BGROUP(parent, strtok(a[2],'|',/EXTRACT), $
EXCLUSIVE = exclusive, NONEXCLUSIVE = 1-exclusive, $
FRAME=frame, NO_RELEASE = no_release, _EXTRA=extra)
endelse
WIDGET_CONTROL, new, GET_VALUE=value
endif else begin
;A.D. Cool Comment out original RSI code for 1 button value
; type = 2
;new = WIDGET_BUTTON(parent, value=values[0], FRAME=frame,
_EXTRA=extra)
;value = 0L

;A.D. Cool Insert a copy of RSI code for 2 or more button values

type = 0
if CW_FORM_PARSE(e, 'SET_VALUE', temp) then begin
result = execute('sval=fix('+temp+')')
new = CW_BGROUP(parent, strtok(a[2],'|',/EXTRACT), $
EXCLUSIVE = exclusive, NONEXCLUSIVE = 1-exclusive, $
FRAME=frame, NO_RELEASE = no_release, $
SET_VALUE = sval, _EXTRA=extra)
endif else begin
new = CW_BGROUP(parent, strtok(a[2],'|',/EXTRACT), $
EXCLUSIVE = exclusive, NONEXCLUSIVE = 1-exclusive, $
FRAME=frame, NO_RELEASE = no_release, _EXTRA=extra)
endelse
WIDGET_CONTROL, new, GET_VALUE=value

endelse


------------------------------------------------------------ -----------------
Andrew D. Cool
Electromagnetics & Propagation Group
Intelligence, Surveillance & Reconnaissance Division
Defence Science & Technology Organisation
PO Box 1500, Edinburgh
South Australia 5111

Phone : 061 8 8259 5740 Fax : 061 8 8259 6673
Email : andrew.cool@no-spam.dsto.defence.gov.au
------------------------------------------------------------ -----------------
Re: sec : U Re: problem with checkbox in cw_form [message #34968 is a reply to message #34875] Tue, 29 April 2003 13:47 Go to previous message
Sergey Koposov is currently offline  Sergey Koposov
Messages: 7
Registered: April 2003
Junior Member
Andrew, Great thanks for the idea and for the example.
Cheers,
Sergey K
Andrew Cool wrote:
> Sergey Koposov wrote:
>
>> Hello!
>> Because, this widget is used in very complicated program, and it would
>> be nice if the values of some parameters entered by user were obtained
>> with single cw_form (it is more simple to get the states of fields with
>> using cw_form then standart widget construction).
>> Moreover, I don't believe that it is impossible to make a single
>> checkbox in cw_form. It would be very strange , I think. :)
>> Cheers,
>> Sergey K
>>
>> Pavel Romashkin wrote:
>>
>>> Why not create the single checkbox in a separate exclusive base, not as
>>> part of cw_form?
>>>
>>> Cheers,
>>> Pavel
>>>
>>> "�x���" wrote:
>>>
>>>
>>>> Can somebody tell me how to create only one checkbox in the cw_form. I dont
>>>> how to do this, because , by default, if there is only one item in the
>>>> initial value field (in the parameters of cw_form) IDL create a simple
>>>> button, but no the checkbox.
>>>> Thanks,
>>>> Sergey Koposov
>
>
>
> Sergey,
>
> CW_FORM is available as a .PRO file in your IDL disribution,
> e.g. look for C:\RSI\IDL56\LIB\CW_FORM.PRO.
>
> CW_FORM.PRO is hardwired to produce single "standard" button if
> you only supply 1 value.
>
> But there's no reason why you can't take a copy of RSI's CW_FORM.PRO
> and put it into your own IDL path, preferably sensibly renamed.
>
> Below I've take a brute force approach and just copied the code for
> multiple buttons into the area for a singel button. It works nicely,
> producing a single checked button.
>
> You might wish to make a more sensitive amendment to the code ;-)
>
> Cheers,
>
> Andrew
>
>
> 'BUTTON': BEGIN
> CW_FORM_APPEND, extra, e, 'LABEL_LEFT', /USE_VALUE
> CW_FORM_APPEND, extra, e, 'LABEL_TOP', /USE_VALUE
> exclusive = CW_FORM_PARSE(e,'EXCLUSIVE')
> no_release = CW_FORM_PARSE(e,'NO_RELEASE')
> values = strtok(a[2],'|', /EXTRACT, ESC='\')
>
> if n_elements(values) ge 2 then begin
> type = 0
> if CW_FORM_PARSE(e, 'SET_VALUE', temp) then begin
> result = execute('sval=fix('+temp+')')
> new = CW_BGROUP(parent, strtok(a[2],'|',/EXTRACT), $
> EXCLUSIVE = exclusive, NONEXCLUSIVE = 1-exclusive, $
> FRAME=frame, NO_RELEASE = no_release, $
> SET_VALUE = sval, _EXTRA=extra)
> endif else begin
> new = CW_BGROUP(parent, strtok(a[2],'|',/EXTRACT), $
> EXCLUSIVE = exclusive, NONEXCLUSIVE = 1-exclusive, $
> FRAME=frame, NO_RELEASE = no_release, _EXTRA=extra)
> endelse
> WIDGET_CONTROL, new, GET_VALUE=value
> endif else begin
> ;A.D. Cool Comment out original RSI code for 1 button value
> ; type = 2
> ;new = WIDGET_BUTTON(parent, value=values[0], FRAME=frame,
> _EXTRA=extra)
> ;value = 0L
>
> ;A.D. Cool Insert a copy of RSI code for 2 or more button values
>
> type = 0
> if CW_FORM_PARSE(e, 'SET_VALUE', temp) then begin
> result = execute('sval=fix('+temp+')')
> new = CW_BGROUP(parent, strtok(a[2],'|',/EXTRACT), $
> EXCLUSIVE = exclusive, NONEXCLUSIVE = 1-exclusive, $
> FRAME=frame, NO_RELEASE = no_release, $
> SET_VALUE = sval, _EXTRA=extra)
> endif else begin
> new = CW_BGROUP(parent, strtok(a[2],'|',/EXTRACT), $
> EXCLUSIVE = exclusive, NONEXCLUSIVE = 1-exclusive, $
> FRAME=frame, NO_RELEASE = no_release, _EXTRA=extra)
> endelse
> WIDGET_CONTROL, new, GET_VALUE=value
>
> endelse
>
>
> ------------------------------------------------------------ -----------------
> Andrew D. Cool
> Electromagnetics & Propagation Group
> Intelligence, Surveillance & Reconnaissance Division
> Defence Science & Technology Organisation
> PO Box 1500, Edinburgh
> South Australia 5111
>
> Phone : 061 8 8259 5740 Fax : 061 8 8259 6673
> Email : andrew.cool@no-spam.dsto.defence.gov.au
> ------------------------------------------------------------ -----------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: problem with checkbox in cw_form
Next Topic: _EXTRA inheritance crashing IDL

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

Current Time: Fri Oct 10 22:44:17 PDT 2025

Total time taken to generate the page: 0.72100 seconds