Skip to content

Problem setting WIDGET_BUTTON value after realization #1533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rdimeo opened this issue Mar 5, 2023 · 2 comments
Closed

Problem setting WIDGET_BUTTON value after realization #1533

rdimeo opened this issue Mar 5, 2023 · 2 comments

Comments

@rdimeo
Copy link

rdimeo commented Mar 5, 2023

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
@GillesDuvert
Copy link
Contributor

Indeed, a bug in set_value for buttons. Value is shown but not updated internally. Thanks for this bug report!

GillesDuvert added a commit to GillesDuvert/gdl that referenced this issue Mar 5, 2023
@GillesDuvert
Copy link
Contributor

solved in #1535, soon in GDL trunk on GH

GillesDuvert added a commit that referenced this issue Mar 6, 2023
correct bug found in #1533 and a few others, related.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants