wxGlade

BlitzMax Modules Forums/Brucey's Modules/wxGlade

http://wxglade.sourceforge.net/apps.php

Anyone have any experience with it? Its a simple free wxWidgets GUI editor. It can apparently export in python, C++, and a couple other languages....


And furthermore, how hard would it be getting code generated from this neat little app to work in blitzmax wxMax? I assume you'd probably have to write a phraser to convert one of the generated languages into blitzmax code. But is there an easyer way?

I've played with it for a bit, its simple, and very easy to get complex gui layouts on screen quickly.

Love to hear your thoughts.

I assume you'd probably have to write a phraser to convert one of the generated languages into blitzmax code.

No, what I would tend to do is write a parser for it's Project File format - which are usually XML.

That's what I've done so far with wxCodeGen (wx.mod/tools) and its support for wxFormBuilder. I've investigated also supporting DialogBlocks, which shouldn't be too hard I think. I haven't seen a saved wxGlade project file yet, so I can't say how hard that might be to include too.

theres not project file format for wxGlade as far as I can tell..


There is:

Lisp
Python
Perl
C++ and
XRC


I'll check out wxFormBuilder

So what is the process of getting code generated from wxFormBuilder to bmax code?

edit: Nevermind I figured it out

theres not project file format for wxGlade as far as I can tell..

Sure there is ;-)
When you save the "project" in wxGlade it creates a ".wxg" file - the project - which is an XML description from which it can be re-loaded into wxGlade.
That is separate from generating C++ or python code.

wxFormBuilder is much the same. You can choose to generate C++ code from the current project.

wxCodeGen can Load .pfb (wxFormbuilder project) files, and from that generate BlitzMax code.
wxCodeGen itself can generate it's own UI code from a .pfb file.

I'm looking into adding support for wxGlade and DialogBlocks.

cool, Form builder and wxcodegen are awsome, but i'm having trouble compiling generated code from wxcodegen.


heres the code:

'
' BlitzMax code generated with wxCodeGen v1.02 : 17 Aug 2008 12:48:25
' 
' 
' PLEASE DO "NOT" EDIT THIS FILE!
' 
SuperStrict

Import wx.wxButton
Import wx.wxFilePickerCtrl
Import wx.wxFrame
Import wx.wxPanel
Import wx.wxStaticText
Import wx.wxTreeCtrl
Import wx.wxWindow


Type myframeBase Extends wxFrame

	Field m_panel1:wxPanel
	Field m_button2:wxButton
	Field m_staticText1:wxStaticText
	Field m_filePicker1:wxFilePickerCtrl
	Field m_treeCtrl1:wxTreeCtrl


	Method Create:myframeBase(parent:wxWindow = Null,id:Int = wxID_ANY, title:String = "Hello world", x:Int = -1, y:Int = -1, w:Int = 800, h:Int = 600, style:Int = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL)
		Return myframeBase(Super.Create(parent, id, title, x, y, w, h, style))
	End Method

	Method OnInit()

		Local bSizer1:wxBoxSizer
		bSizer1 = New wxBoxSizer.Create(wxVERTICAL)
		m_panel1 = New wxPanel.Create(Self, wxID_ANY, 400,300,,, wxTAB_TRAVERSAL)

		Local bSizer2:wxBoxSizer
		bSizer2 = New wxBoxSizer.Create(wxVERTICAL)
		m_button2 = New wxButton.Create(m_panel1, wxID_ANY, "MyButton", 400,300)
		bSizer2.Add(m_button2, 0, wxALL, 5)

		m_staticText1 = New wxStaticText.Create(m_panel1, wxID_ANY, "Hello world")
		m_staticText1.Wrap(-1)
		bSizer2.Add(m_staticText1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5)

		m_filePicker1 = New wxFilePickerCtrl.Create(m_panel1, wxID_ANY, "", "Select a file", "*.*",,,,, wxFLP_DEFAULT_STYLE)

		bSizer2.Add(m_filePicker1, 0, wxALL, 5)

		m_treeCtrl1 = New wxTreeCtrl.Create(m_panel1, wxID_ANY,,,,, wxTR_DEFAULT_STYLE)
		bSizer2.Add(m_treeCtrl1, 1, wxALL|wxEXPAND, 5)

		m_panel1.SetSizer(bSizer2)
		m_panel1.Layout()
		bSizer1.Add(m_panel1, 1, wxEXPAND | wxALL, 5)

		SetSizer(bSizer1)
		Layout()

	End Method

End Type


and the errors:

Building main
Compiling:main.bmx
flat assembler  version 1.66
3 passes, 25356 bytes.
Linking:main.debug.exe
D:/programming/BlitzMax/mod/wx.mod/wx.mod/wx.debug.win32.x86.a(wxglue.cpp.debug.win32.x86.o):wxglue.cpp:(.text+0x2f5): undefined reference to `_wx_wxapp_wxApp__OnInit'
D:/programming/BlitzMax/mod/wx.mod/wx.mod/wx.debug.win32.x86.a(wxglue.cpp.debug.win32.x86.o):wxglue.cpp:(.text+0x309): undefined reference to `_wx_wxapp_wxApp__OnExit'
D:/programming/BlitzMax/mod/wx.mod/wx.mod/wx.debug.win32.x86.a(wxglue.cpp.debug.win32.x86.o):wxglue.cpp:(.text+0x355): undefined reference to `_wx_wxapp_wxAppMain__MainLoop'
Build Error: Failed to link D:/programming/Programs/Source/BlitzMax/test/main.debug.exe
Process complete


Thanks for all the help!

You'll need some more code with that.

If you look in the "Application Code" tab of wxCodeGen you'll see a bit of example "stub" code that you can use.

The design of wxCodeGen's generated code allows you to keep the generated .bmx code as a separate file from the rest of your application. This way you can safely re-generate that file at any time without worrying about losing any changes.

In the stub code, where it says "Add frame creation code here", you could add :
Local frame:myFrame = myFrame(new myFrame.Create())
frame.Show()


:o)

You might also want to update a bit... as v1.02 of wxCodeGen is quite old. (eg. lacking features and bug-fixes)

you probably need a glade plug-in




heh. Nice one ;-)

I'm at rev 503 on svn... and it won't update any further... is there a seperate download for this tool?

EDIT: I recompiled the codegen source and it now reads as v1.10 -- problem solved?

also, how do you move gadgets around the window in form builder?