Another wxRadio bug

BlitzMax Modules Forums/Brucey's Modules/Another wxRadio bug

Hello, radio buttons seem to not like me :)

This bug causes the application to freeze completely, and I've managed to recreate the problem with a small example. Basically I wanted to put a set of radio buttons on their own panel, so that I could disable that panel, and therefore "grey out" the static box sizer and all the controls it contained when they didn't apply based various other settings were active/inactive.

Here's the example:

'
' BlitzMax code generated with wxCodeGen v1.06 : 28 Jan 2009 22:22:04
' 
' 
' PLEASE DO "NOT" EDIT THIS FILE!
' 
SuperStrict

Framework wx.wxApp
Import wx.wxFrame
Import wx.wxNotebook
Import wx.wxPanel
Import wx.wxRadioButton
Import wx.wxStaticBoxSizer
Import wx.wxWindow


Type MyFrame1Base Extends wxFrame

	Field m_notebook1:wxNotebook
	Field m_panel1:wxPanel
	Field m_radioBtn1:wxRadioButton
	Field m_radioBtn2:wxRadioButton
	Field m_radioBtn3:wxRadioButton
	Field m_panel4:wxPanel
	Field m_radioBtn4:wxRadioButton
	Field m_radioBtn5:wxRadioButton
	Field m_radioBtn6:wxRadioButton
	Field m_panel2:wxPanel
	Field m_panel3:wxPanel


	Method Create:MyFrame1Base(parent:wxWindow = Null,id:Int = wxID_ANY, title:String = "", x:Int = -1, y:Int = -1, w:Int = 500, h:Int = 300, style:Int = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL)
		return MyFrame1Base(Super.Create(parent, id, title, x, y, w, h, style))
	End Method

	Method OnInit()

		Local bSizer1:wxBoxSizer
		bSizer1 = new wxBoxSizer.Create(wxVERTICAL)
		m_notebook1 = new wxNotebook.Create(Self, wxID_ANY)
		m_panel1 = new wxPanel.Create(m_notebook1, wxID_ANY,,,,, wxTAB_TRAVERSAL)

		Local bSizer2:wxBoxSizer
		bSizer2 = new wxBoxSizer.Create(wxVERTICAL)

		Local bSizer7:wxBoxSizer
		bSizer7 = new wxBoxSizer.Create(wxVERTICAL)
		m_radioBtn1 = new wxRadioButton.Create(m_panel1, wxID_ANY, "RadioBtn",,,,, wxRB_GROUP)
		bSizer7.Add(m_radioBtn1, 0, wxALL, 5)

		m_radioBtn2 = new wxRadioButton.Create(m_panel1, wxID_ANY, "RadioBtn")
		bSizer7.Add(m_radioBtn2, 0, wxALL, 5)

		m_radioBtn3 = new wxRadioButton.Create(m_panel1, wxID_ANY, "RadioBtn")
		bSizer7.Add(m_radioBtn3, 0, wxALL, 5)

		bSizer2.AddSizer(bSizer7, 1, wxEXPAND, 5)


		Local bSizer3:wxBoxSizer
		bSizer3 = new wxBoxSizer.Create(wxVERTICAL)
		m_panel4 = new wxPanel.Create(m_panel1, wxID_ANY,,,,, wxTAB_TRAVERSAL)

		Local sbSizer1:wxStaticBoxSizer
		sbSizer1 = new wxStaticBoxSizer.CreateSizerWithBox( new wxStaticBox.Create(m_panel4, wxID_ANY, "label"), wxVERTICAL)
		m_radioBtn4 = new wxRadioButton.Create(m_panel4, wxID_ANY, "RadioBtn",,,,, wxRB_GROUP)
		sbSizer1.Add(m_radioBtn4, 0, wxALL, 5)

		m_radioBtn5 = new wxRadioButton.Create(m_panel4, wxID_ANY, "RadioBtn")
		sbSizer1.Add(m_radioBtn5, 0, wxALL, 5)

		m_radioBtn6 = new wxRadioButton.Create(m_panel4, wxID_ANY, "RadioBtn")
		sbSizer1.Add(m_radioBtn6, 0, wxALL, 5)

		m_panel4.SetSizer(sbSizer1)
		m_panel4.Layout()
		sbSizer1.Fit(m_panel4)
		bSizer3.Add(m_panel4, 1, wxEXPAND | wxALL, 5)

		bSizer2.AddSizer(bSizer3, 1, wxEXPAND, 5)

		m_panel1.SetSizer(bSizer2)
		m_panel1.Layout()
		bSizer2.Fit(m_panel1)
		m_notebook1.AddPage(m_panel1, "a page", True)

		m_panel2 = new wxPanel.Create(m_notebook1, wxID_ANY,,,,, wxTAB_TRAVERSAL)
		m_notebook1.AddPage(m_panel2, "a page", False)

		m_panel3 = new wxPanel.Create(m_notebook1, wxID_ANY,,,,, wxTAB_TRAVERSAL)
		m_notebook1.AddPage(m_panel3, "a page", False)


		bSizer1.Add(m_notebook1, 1, wxEXPAND | wxALL, 5)

		SetSizer(bSizer1)
		Layout()

	End Method

End Type

New MyApp.Run()

Type MyApp Extends wxApp

	Field mainwin:MyFrame1
	
	Method OnInit:Int()

		mainwin = MyFrame1(New MyFrame1.Create(,, "Timeline Particle Editor",,, 1024, 768))

		mainwin.Show()

		Return True
	End Method

End Type

Type MyFrame1 Extends MyFrame1Base

	Method OnInit()
		Super.OnInit()

		' Add own initialisation code here

	End Method

End Type



I bet it's another windows issue, bah! :)

Oh, to crash it, just run and click a radio button in the first group.

Thanks!

It might be to do with this Style mentioned in the documentation :

wxRB_SINGLE:
In some circumstances, radio buttons that are not consecutive siblings trigger a hang bug in Windows (only). If this happens, add this style to mark the button as not belonging to a group, and implement the mutually-exclusive group behaviour yourself.



?

Ahh interesting. Yeh that seems to have fixed it. Hmm, I winder if that will fix the other problem I was having with the radio buttons generating events when switching tabs...

I'm not sure, but this Windows bug is an old one. I believe you can also crash MaxGUI in the same way...
Fun fun ;-)

No it doesn't, which is a shame. I might try and use radio boxes instead as they seem to be free of these issues, haven't properly tested yet though.