Radio Button bug!

Archives Forums/MaxGUI Bug Reports/Radio Button bug!

SLotman(Posted 2016) [#1]
Sorry for the messy example - but this shows a radio button in the main window interfering with 2 other radio buttons inside *two* group panels. To see the bug, just hit the "show me the bug" radio button, then try the option1/option2 buttons to see the issue.

No idea how to fix this :P




Midimaster(Posted 2016) [#2]
I added a PRINT into your code. As you can see in my code, your app hangs, when clicking on the Button "btnShowBug". Even EXIT does not work after clicking the button.
SuperStrict

Import maxgui.drivers

Global Window:TGadget, grp1:TGadget, grp2:TGadget, radio1:TGadget, btnShowBug:TGadget			
	
Window=CreateWindow("Radio button bug sample",10,10,800,400,Null,WINDOW_TITLEBAR|WINDOW_CENTER)
grp1=CreatePanel(60,10,584,288,Window,PANEL_BORDER)
grp2=CreatePanel(360,48,296,90,grp1,PANEL_BORDER)

btnShowBug=CreateButton("Show me the bug!",10,10,112,40,grp1,BUTTON_RADIO)
radio1=CreateButton("Option 1",20,24,96,16,grp2,BUTTON_RADIO)

Repeat
	Select WaitEvent()
		Case EVENT_GADGETACTION						' interacted with gadget
			Print "action"
		Case EVENT_WINDOWCLOSE						' close gadget
			Exit
	End Select
	
Until AppTerminate()




I think it is necessary to add a container for each radio button group, which contains nothing but the buttons. Your grp1 contains the button, but also a panel....

SuperStrict

Import maxgui.drivers

Global Window:TGadget, grp1:TGadget, grp2:TGadget, grp3:TGadget
Global radio1:TGadget, radio2:TGadget, btnShowBug:TGadget, btnShowBug2:TGadget			
	
Window=CreateWindow("Radio button bug sample",10,10,800,400,Null,WINDOW_TITLEBAR|WINDOW_CENTER)
grp1=CreatePanel(60,10,584,288,Window,PANEL_BORDER)
grp2=CreatePanel(260,48,296,90,grp1,PANEL_BORDER)
grp3=CreatePanel(0,48,296,90,grp1)

btnShowBug=CreateButton("Show me the bug!",10,10,152,40,grp3,BUTTON_RADIO)
btnShowBug2=CreateButton("Show me no bug!",10,50,152,40,grp3,BUTTON_RADIO)

radio1=CreateButton("Option 1",20,20,96,16,grp2,BUTTON_RADIO)
radio2=CreateButton("Option 2",20,60,96,16,grp2,BUTTON_RADIO)

Repeat
	Select WaitEvent()
		Case EVENT_GADGETACTION						' interacted with gadget
			Print "action"
		Case EVENT_WINDOWCLOSE						' close gadget
			Exit
	End Select
	
Until AppTerminate()



SLotman(Posted 2016) [#3]

I added a PRINT into your code. As you can see in my code, your app hangs(...)


Nope, it doesn't hang here. It keeps working, but everytime I click in the bug radio button, the other two are cleared. If I click on the other two, they have no effect in the "bug" (Downloaded MaxGUI today from sourceforge)

Now seeing your sample... so, the only way to isolate is through a panel for every one?

Sheesh =/


degac(Posted 2016) [#4]
Hi
just checked and I confirm.
I did another source test to see the button state. Every single button-state is 'right' inside the 'group' ,but when you click a 'parent' everything is reset to zero.

I just looked in win32maxguiex.bmx, it seems that the 'group' is considered when the win gadget is created, but when the state is checked/changed there's no check about nested group.
And it seems it wasn't designed to handled this.


degac(Posted 2016) [#5]
In my own hacked MaxGUI version I can 'save' all the gadgets state, so I know the problem could be resolved.
Unfortunately I didn't write that function for this specific situation, just to speed up GUI creation (auto alignment of gadgets).

edit: my error, it seems I confirm that the 'state' is handled more deeper (win32maxguiex in XP), so only the initial state is valid, at the first 'click' everything is lost!


Henri(Posted 2016) [#6]
Hi,

I don't think it's a MaxGUI bug as such, more like the nature of radiobuttons which are linked to a group in order to operate correctly.
You can add different gadgets inside radio group, just not another radio group.

-Henri


Midimaster(Posted 2016) [#7]
I use Win-XP and BlitzMax 1.50. In both (SLotMan's and degac's) version The app hangs ("Keine Rückmeldung")....

To use another Panel as invisible container is a possible solution. But I don't know if it is the only way...