wxCodeGen

BlitzMax Modules Forums/Brucey's Modules/wxCodeGen

What do I wrong when this happens:

wxFormBuilder:


wxCodeGen Output:


Is there something wrong in my layout - or are there any limitations in exporting to bmax?

'
' BlitzMax code generated with wxCodeGen v1.05 : 11 Aug 2008 21:20:00
' 
' 
' PLEASE DO "NOT" EDIT THIS FILE!
' 
SuperStrict

Import wx.wxButton
Import wx.wxComboBox
Import wx.wxFrame
Import wx.wxMenu
Import wx.wxMenuBar
Import wx.wxPanel
Import wx.wxStaticText
Import wx.wxStatusBar
Import wx.wxTextCtrl
Import wx.wxToolBar
Import wx.wxWindow


Type winMainBase Extends wxFrame

	Field m_toolBar1:wxToolBar
	Field m_staticText1:wxStaticText
	Field m_comboBox1:wxComboBox
	Field m_staticText2:wxStaticText
	Field m_comboBox2:wxComboBox
	Field m_staticText3:wxStaticText
	Field m_textCtrl1:wxTextCtrl
	Field m_textCtrl2:wxTextCtrl
	Field m_button1:wxButton
	Field m_panel_main:wxPanel
	Field m_menubar1:wxMenuBar
	Field m_menu_file:wxMenu
	Field m_menu_view:wxMenu
	Field m_menu_zoom:wxMenu
	Field m_statusBar1:wxStatusBar


	Method Create:winMainBase(parent:wxWindow = Null,id:Int = wxID_ANY, title:String = "MapViewer", x:Int = -1, y:Int = -1, w:Int = 640, h:Int = 480, style:Int = wxDEFAULT_FRAME_STYLE|wxALWAYS_SHOW_SB|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL)
		Return winMainBase(Super.Create(parent, id, title, x, y, w, h, style))
	End Method

	Method OnInit()
		SetMinSize(640,480)

		Local fgSizer1:wxFlexGridSizer
		fgSizer1 = New wxFlexGridSizer.CreateRC(2, 1, 2, 2)
		fgSizer1.AddGrowableCol( 0 )
		fgSizer1.AddGrowableRow( 1 )
		fgSizer1.SetFlexibleDirection( wxBOTH )
		fgSizer1.SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED )
		m_toolBar1 = CreateToolBar(wxTB_HORIZONTAL, wxID_ANY)
		m_staticText1 = New wxStaticText.Create(Self, wxID_ANY, "Stadt:")
		m_staticText1.Wrap(-1)
		m_comboBox1 = New wxComboBox.Create(Self, wxID_ANY, "Combo!", Null)
		m_toolBar1.AddSeparator()
		m_staticText2 = New wxStaticText.Create(Self, wxID_ANY, "Region:")
		m_staticText2.Wrap(-1)
		m_comboBox2 = New wxComboBox.Create(Self, wxID_ANY, "Combo!", Null)
		m_toolBar1.AddSeparator()
		m_staticText3 = New wxStaticText.Create(Self, wxID_ANY, "Koordinaten:")
		m_staticText3.Wrap(-1)
		m_textCtrl1 = New wxTextCtrl.Create(Self, wxID_ANY, "",,, 32,-1)
		m_textCtrl1.SetMaxLength(0)
		m_textCtrl1.SetMinSize(32,-1)
		m_textCtrl1.SetMaxSize(32,-1)
		m_toolBar1.AddSeparator()
		m_textCtrl2 = New wxTextCtrl.Create(Self, wxID_ANY, "",,, 32,-1)
		m_textCtrl2.SetMaxLength(0)
		m_textCtrl2.SetMinSize(32,-1)
		m_textCtrl2.SetMaxSize(32,-1)
		m_toolBar1.AddSeparator()
		m_button1 = New wxButton.Create(Self, wxID_ANY, "Springe")
		m_toolBar1.Realize()

		fgSizer1.Add(m_toolBar1, 0, wxEXPAND, 5)

		m_panel_main = New wxPanel.Create(Self, wxID_ANY,,,,, wxHSCROLL|wxSUNKEN_BORDER|wxTAB_TRAVERSAL|wxVSCROLL)
		fgSizer1.Add(m_panel_main, 1, wxEXPAND | wxALL, 5)

		m_menubar1 = New wxMenuBar.Create()

		m_menu_file = New wxMenu.Create()

		Local m_menuItem_savepicture:wxMenuItem
		m_menuItem_savepicture = New wxMenuItem.Create(m_menu_file, wxID_ANY, "Bild speichern", "", wxITEM_NORMAL)
		m_menu_file.AppendItem(m_menuItem_savepicture)

		m_menu_file.AppendSeparator()

		Local m_menuItem1_exit:wxMenuItem
		m_menuItem1_exit = New wxMenuItem.Create(m_menu_file, wxID_ANY, "Beenden", "", wxITEM_NORMAL)
		m_menu_file.AppendItem(m_menuItem1_exit)
		m_menubar1.Append(m_menu_file, "Datei")

		m_menu_view = New wxMenu.Create()

		m_menu_zoom = New wxMenu.Create()

		Local m_menuItem_zoom1:wxMenuItem
		m_menuItem_zoom1 = New wxMenuItem.Create(m_menu_zoom, wxID_ANY, "Stufe 1", "", wxITEM_RADIO)
		m_menu_zoom.AppendItem(m_menuItem_zoom1)

		Local m_menuItem_zoom2:wxMenuItem
		m_menuItem_zoom2 = New wxMenuItem.Create(m_menu_zoom, wxID_ANY, "Stufe 2", "", wxITEM_RADIO)
		m_menu_zoom.AppendItem(m_menuItem_zoom2)

		Local m_menuItem_zoom4:wxMenuItem
		m_menuItem_zoom4 = New wxMenuItem.Create(m_menu_zoom, wxID_ANY, "Stufe 4", "", wxITEM_RADIO)
		m_menu_zoom.AppendItem(m_menuItem_zoom4)

		Local m_menuItem_zoom6:wxMenuItem
		m_menuItem_zoom6 = New wxMenuItem.Create(m_menu_zoom, wxID_ANY, "Stufe 6", "", wxITEM_RADIO)
		m_menu_zoom.AppendItem(m_menuItem_zoom6)

		Local m_menuItem_zoom8:wxMenuItem
		m_menuItem_zoom8 = New wxMenuItem.Create(m_menu_zoom, wxID_ANY, "Stufe 8", "", wxITEM_RADIO)
		m_menu_zoom.AppendItem(m_menuItem_zoom8)

		Local m_menuItem_zoom10:wxMenuItem
		m_menuItem_zoom10 = New wxMenuItem.Create(m_menu_zoom, wxID_ANY, "Stufe 10", "", wxITEM_RADIO)
		m_menu_zoom.AppendItem(m_menuItem_zoom10)

		Local m_menuItem_zoom12:wxMenuItem
		m_menuItem_zoom12 = New wxMenuItem.Create(m_menu_zoom, wxID_ANY, "Stufe 12", "", wxITEM_RADIO)
		m_menu_zoom.AppendItem(m_menuItem_zoom12)

		Local m_menuItem_zoom14:wxMenuItem
		m_menuItem_zoom14 = New wxMenuItem.Create(m_menu_zoom, wxID_ANY, "Stufe 14", "", wxITEM_RADIO)
		m_menu_zoom.AppendItem(m_menuItem_zoom14)

		Local m_menuItem_zoom16:wxMenuItem
		m_menuItem_zoom16 = New wxMenuItem.Create(m_menu_zoom, wxID_ANY, "Stufe 16", "", wxITEM_RADIO)
		m_menu_zoom.AppendItem(m_menuItem_zoom16)

		Local m_menuItem_zoom24:wxMenuItem
		m_menuItem_zoom24 = New wxMenuItem.Create(m_menu_zoom, wxID_ANY, "Stufe 24", "", wxITEM_RADIO)
		m_menu_zoom.AppendItem(m_menuItem_zoom24)

		Local m_menuItem_zoom32:wxMenuItem
		m_menuItem_zoom32 = New wxMenuItem.Create(m_menu_zoom, wxID_ANY, "Stufe 32", "", wxITEM_RADIO)
		m_menu_zoom.AppendItem(m_menuItem_zoom32)

		Local m_menuItem_zoom64:wxMenuItem
		m_menuItem_zoom64 = New wxMenuItem.Create(m_menu_zoom, wxID_ANY, "Stufe 64", "", wxITEM_RADIO)
		m_menu_zoom.AppendItem(m_menuItem_zoom64)
		m_menu_view.AppendMenu(-1, "Zoom", m_menu_zoom)

		Local m_menuitem_raster:wxMenuItem
		m_menuitem_raster = New wxMenuItem.Create(m_menu_view, wxID_ANY, "Raster", "", wxITEM_CHECK)
		m_menu_view.AppendItem(m_menuitem_raster)

		Local m_menuItem_farbe:wxMenuItem
		m_menuItem_farbe = New wxMenuItem.Create(m_menu_view, wxID_ANY, "Farbkodierung", "", wxITEM_CHECK)
		m_menu_view.AppendItem(m_menuItem_farbe)

		m_menu_view.AppendSeparator()

		Local m_menuItem_stadt:wxMenuItem
		m_menuItem_stadt = New wxMenuItem.Create(m_menu_view, wxID_ANY, "Stadtplanung", "", wxITEM_CHECK)
		m_menu_view.AppendItem(m_menuItem_stadt)

		Local m_menuItem_burgen:wxMenuItem
		m_menuItem_burgen = New wxMenuItem.Create(m_menu_view, wxID_ANY, "Burgreichweite", "", wxITEM_CHECK)
		m_menu_view.AppendItem(m_menuItem_burgen)

		Local m_menuItem_armeen:wxMenuItem
		m_menuItem_armeen = New wxMenuItem.Create(m_menu_view, wxID_ANY, "Armeen anzeigen", "", wxITEM_CHECK)
		m_menu_view.AppendItem(m_menuItem_armeen)
		m_menubar1.Append(m_menu_view, "Ansicht")
		SetMenuBar(m_menubar1)

		m_statusBar1 = Self.CreateStatusBar(1, 0|wxST_SIZEGRIP, wxID_ANY)

		SetSizer(fgSizer1)
		Layout()
		Center(wxBOTH)

	End Method

End Type




Something isn't quite right there, is it?

sorry, was a wrong basedir on my webspace ;)

Okay.. the toolbar generator isn't working properly.

It is adding controls to the wrong parent, and missing out another method call.

I'll have a look at it now.

thanks a lot :)

I've updated SVN with the latest wxCodeGen.

Hi,

thank you for the adaption - I think there happened something to the Separator-Control:

		m_toolBar1.AddSeparator()
		'm_toolBar1.AddControl()
		m_staticText2 = New wxStaticText.Create(m_toolBar1, wxID_ANY, "Region:")
		m_staticText2.Wrap(-1)
		m_toolBar1.AddControl(m_staticText2)
		m_comboBox2 = New wxComboBox.Create(m_toolBar1, wxID_ANY, "Combo!", Null)
		m_toolBar1.AddControl(m_comboBox2)
		m_toolBar1.AddSeparator()
		'm_toolBar1.AddControl()
		m_staticText3 = New wxStaticText.Create(m_toolBar1, wxID_ANY, "Koordinaten:")
		m_staticText3.Wrap(-1)
		m_toolBar1.AddControl(m_staticText3)
		m_textCtrl1 = New wxTextCtrl.Create(m_toolBar1, wxID_ANY, "",,, 32,-1)
		m_textCtrl1.SetMaxLength(0)
		m_textCtrl1.SetMinSize(32,-1)
		m_textCtrl1.SetMaxSize(32,-1)
		m_toolBar1.AddControl(m_textCtrl1)
		m_toolBar1.AddSeparator()
		'm_toolBar1.AddControl()
		m_textCtrl2 = New wxTextCtrl.Create(m_toolBar1, wxID_ANY, "",,, 32,-1)
		m_textCtrl2.SetMaxLength(0)
		m_textCtrl2.SetMinSize(32,-1)
		m_textCtrl2.SetMaxSize(32,-1)
		m_toolBar1.AddControl(m_textCtrl2)
		m_toolBar1.AddSeparator()
		'm_toolBar1.AddControl()


I have to comment out the .AddControl() Methodcall after the .AddSeparator() to get it working.

But another question:
How to I get rid off the space between the MenuBar and the ToolBar? Is there something wrong how I used the Sizer?


m_toolBar1.AddSeparator()
'm_toolBar1.AddControl()


Oh.. I didn't notice that in my test.. silly.

How to I get rid off the space between the MenuBar and the ToolBar?

I'm not sure. I'll need to compare the output of wxCodeGen and the C++... I'll get back to you.

I think I found my mistake - I may not drag the toolbar as a child to the Sizer. It has to be directly at the main window.

I may not drag the toolbar as a child to the Sizer. It has to be directly at the main window.

Actually, you can do either. There was a bug in the generator which incorrectly attached the toolbar to the frame, instead of the sizer. Which I've fixed now. (hopefully)

thank you, everything works now fine - even the toolbar inside the sizer :)