Re: Problem with /sensitive [message #29510] |
Sat, 23 February 2002 08:30 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning (david@dfanning.com) writes:
> Here is a little test program that seems to work
> perfectly on both IDL 5.4 and IDL 5.5 on Windows 2000.
> I'm thinking this problem may have more to do with how
> the widgets are created with the GUI Builder than with
> how IDL works.
I forgot about the slider. Here is an updated program
with a slider in it, too. All appears to work as expected.
Cheers,
David
Pro test_sensitive_event, event
Widget_Control, event.top, get_Uvalue=info
Widget_Control, event.id, Get_Value=buttonValue
IF tag_names(event, /structure_name) EQ 'WIDGET_SLIDER' THEN BEGIN
Print, event.value
RETURN
ENDIF
IF event.select NE 1 THEN RETURN
CASE buttonValue of
'Make Sensitive': BEGIN
Widget_Control, info.base, Sensitive=1
Widget_Control, info.base2, Sensitive=1
END
'Make Insensitive': BEGIN
Widget_Control, info.base, Sensitive=0
Widget_Control, info.base2, Sensitive=0
END
ELSE: Print, buttonValue
ENDCASE
END
PRO test_sensitive
tlb = Widget_Base(col=1)
base = Widget_Base(tlb,col=1, /exclusive, sensitive=0)
button = Widget_button(base, Value='Button One Test')
button = Widget_button(base, Value='Button Two Test')
Widget_Control, button, Set_Button=1
base2 = Widget_Base(tlb, row=1, sensitive = 0)
slider = Widget_Slider(base2, min=0, max=10, value=5)
makeit = Widget_Button(tlb, Value='Make Sensitive')
makeit = Widget_Button(tlb, Value='Make Insensitive')
Widget_control, tlb, /REalize, Set_UValue={base:base, base2:base2}
XManager, 'test_sensitive', tlb, /No_block
END
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Problem with /sensitive [message #29511 is a reply to message #29510] |
Sat, 23 February 2002 08:22  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Mike Burton (burton@ct.ingv.it) writes:
> I've written a widget program that contains a base widget holding a
> series of radio buttons. I want this base to be insensitive until
> certain actions are performed. The problem arises when I try to
> sensitise the buttons by making the base widget sensitive: it doesn't
> turn on the radio buttons. The buttons themselves are sensitive on
> creation, so the problem is that desensitizing the base widget also
> desensitizes the radio buttons, but resensitizing the base widget does
> not sensitize the buttons. Strange. I can do each button individually,
> but would prefer to do all in one go.
>
> This is a more serious problem for the slider_widget. When this is
> insensitive on creation and later sensitized I see it go from gray to
> active but the slider buar does not appear. I wonder if this is the
> smae problem of sensitivity not working its way down the widget
> hierarchy...
>
> Well, it's not a show-stopper but it is annoying and I'd greatly
> appreciate any solutions that you guys know of.
>
> The system is IDL 5.4 on win2k using the guibuilder.
Here is a little test program that seems to work
perfectly on both IDL 5.4 and IDL 5.5 on Windows 2000.
I'm thinking this problem may have more to do with how
the widgets are created with the GUI Builder than with
how IDL works.
Cheers,
David
Pro test_sensitive_event, event
IF event.select NE 1 THEN RETURN
Widget_Control, event.top, get_Uvalue=info
Widget_Control, event.id, Get_Value=buttonValue
CASE buttonValue of
'Make Sensitive': Widget_Control, info.base, Sensitive=1
'Make Insensitive': Widget_Control, info.base, Sensitive=0
ELSE: Print, buttonValue
ENDCASE
END
PRO test_sensitive
tlb = Widget_Base(col=1)
base = Widget_Base(tlb,col=1, /exclusive, sensitive=0)
button = Widget_button(base, Value='Button One Test')
button = Widget_button(base, Value='Button Two Test')
Widget_Control, button, Set_Button=1
makeit = Widget_Button(tlb, Value='Make Sensitive')
makeit = Widget_Button(tlb, Value='Make Insensitive')
Widget_control, tlb, /REalize, Set_UValue={base:base}
XManager, 'test_sensitive', tlb, /No_block
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|