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

Home » Public Forums » archive » Sensitive options 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
Sensitive options in cw_form [message #34873] Tue, 29 April 2003 10:02 Go to next message
jimby is currently offline  jimby
Messages: 4
Registered: August 2002
Junior Member
In the following example program, I would like to make label3 and
label4 insensitive if 'opt2' were selected from the droplist, and
sensitive if 'opt3' were selected from the droplist. I tried
accessing the IDs from the call to cw_form, but I couldn't get those
IDs until I created an action by pressing 'Cancel' or 'Label'. I
thought by using these IDs, I could someone do this. Ideas?

Thanks,
Jim


pro test

formdesc = ['0, droplist, opt1|opt2|opt3,label_left=Options:,
set_value=0 ', $
'0, text, , label_left=label1: , width=15', $
'0, text, , label_left=label2: , width=15', $
'0, text, , label_left=label3: , width=15', $
'0, text, , label_left=label4: , width=15', $
'1, base, , row', $
'0, button, Cancel, quit', $
'0, button, Label, quit']

textform = cw_form(formdesc, /column,title = 'Label',IDS=ids)

end
sec : U Re: Sensitive options in cw_form [message #34965 is a reply to message #34873] Tue, 29 April 2003 19:10 Go to previous message
Andrew Cool is currently offline  Andrew Cool
Messages: 219
Registered: January 1996
Senior Member
Jim Brauher wrote:
>
> In the following example program, I would like to make label3 and
> label4 insensitive if 'opt2' were selected from the droplist, and
> sensitive if 'opt3' were selected from the droplist. I tried
> accessing the IDs from the call to cw_form, but I couldn't get those
> IDs until I created an action by pressing 'Cancel' or 'Label'. I
> thought by using these IDs, I could someone do this. Ideas?
>
> Thanks,
> Jim
>

Hi Jim,

Gosh, my second response to a CW_FORM query in 2 days, and I've
never even used the routine!

Try putting your CW_FORM inside a base.
After calling widget_control,base,/real your ids are available.

Text widgets are "type" 3.

Setting the TAG keyword, TAG=options is the key to handling the events.

Hope this helps,

Andrew


PRO test_cwf_event,ev

Common stuff, text_widget_ids

Case ev.tag of

'OPTIONS' : $
Begin
Case ev.value of
'0' : $
Begin

End
'1' : $
Begin
widget_control,text_widget_ids(2),Sensitive=0
widget_control,text_widget_ids(3),Sensitive=0
End
'2' : $
Begin

widget_control,text_widget_ids(2),Sensitive=1

widget_control,text_widget_ids(3),Sensitive=1
End
Else :
End
End

Else :
End

End

;.......................................

PRO test_cwf

Common stuff, text_widget_ids

base = widget_base(/row)

formdesc = ['0, droplist,
opt1|opt2|opt3,label_left=Options:,set_value=0,TAG=options ', $
'0, text, , label_left=label1: , width=15', $
'0, text, , label_left=label2: , width=15', $
'0, text, , label_left=label3: , width=15', $
'0, text, , label_left=label4: , width=15', $
'1, base, , row', $
'0, button, Cancel, quit', $
'0, button, Label, quit']



textform = cw_form(base,formdesc, /column,title = 'Label',IDS=ids)
widget_control,base,/real

print,'Ids = ',ids
text_widget_ids = ids(where(widget_info(ids,/type) eq 3))
print,'text widget ids = ',text_widget_ids

; Insert some text so we can see effect of sensitivity

widget_control,text_widget_ids(2),Set_Value = 'Text 3'
widget_control,text_widget_ids(3),Set_Value = 'Text 4'

Xmanager,'test_cwf',base

End


------------------------------------------------------------ -----------------
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@dsto.defence.gov.au
------------------------------------------------------------ -----------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: _EXTRA inheritance crashing IDL
Next Topic: file_info bug

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

Current Time: Sat Oct 11 19:05:01 PDT 2025

Total time taken to generate the page: 1.99746 seconds