You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to change the value of a WIDGET_BUTTON each time I press it. Specifically, The following code works fine in IDL but somehow the SET_VALUE keyword in WIDGET_CONTROL for the WIDGET_BUTTON does not work as it should. When you press the button labeled "A", it changes to "B" as it should. However, when you press the button again, it does not change to "A" as it should. Thanks in advance for any insights.
; ********************** ;
pro test_button_event,event
widget_control,event.id,get_value = val
print,val
uname = widget_info(event.id,/uname)
case uname of
'QUIT' : widget_control,event.top,/destroy
'BUTTON': begin
widget_control,event.id,get_value = val
if val eq 'A' then begin
widget_control,event.id,set_value = 'B'
endif else begin
widget_control,event.id,set_value = 'A'
endelse
end
endcase
end
; ********************** ;
pro test_button
; Widget definition procedure
tlb = widget_base(/col)
void = widget_button(tlb,value = 'A',uname = 'BUTTON',xsize = 150)
void = widget_button(tlb,value = 'Quit',uname = 'QUIT',xsize = 150)
widget_control,tlb,/realize
xmanager, 'test_button',tlb,/no_block,event_handler = 'test_button_event'
end
The text was updated successfully, but these errors were encountered:
I want to change the value of a WIDGET_BUTTON each time I press it. Specifically, The following code works fine in IDL but somehow the SET_VALUE keyword in WIDGET_CONTROL for the WIDGET_BUTTON does not work as it should. When you press the button labeled "A", it changes to "B" as it should. However, when you press the button again, it does not change to "A" as it should. Thanks in advance for any insights.
The text was updated successfully, but these errors were encountered: