ANN: wxGuiBuilder is released!

Do you like to promote your wxWidgets based application or component!? Post it here and let's see what the critics have to say. Also, if you found that ONE wx component the world needs to know about, put it here for future reference.
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

ANN: wxGuiBuilder is released!

Post by Jorg » Wed Jun 07, 2006 7:44 am

Hi everybody,

I am pleased to inform you all that I bridged the gap between designing a GUI / sizer layout in a stand alone editor and an XRC like solution. It's called wxGuiBuilder and it's a class that can be used directly in the code. It uses a terse but intuitive markup language to write down your GUI controls and sizers in a textual representation. It should make it easier for beginning wxWidgets developers to grasp the concept of sizers, without having to dig into wxSizer code.

The class creates the sizer layouting and optionally creates the controls too with the appropiate flags. It can be used in the code like this:

Code: Select all

#include "guibuilder.h"

wxGuiBuilder gb("H{ ['OK'] ['Cancel' ] }");
if(gb.Build(this))
     this->SetSizerAndFit(gb.GetSizer());
This will produce a wxBoxSizer_H with two buttons inside. The GUI markup text can be as complex as you want. It can contain nested sizers, other GUI controls, etc. The only thing that you need to do is call Build() to let the wxSizer structure be set up for you and assign it to a wxPanel, wxFrame or wxDialog. That's it! I created a demo application as well that explains all aspects of the wxGuiBuilder class, plus the online documentation has both a guide and grammar summary.

A more comprehensive tutorial and guide can be found here:
* http://www.xs4all.nl/~jorgb/components/guibuilder/help/

The main site is here:
* http://wastebucket.solidsteel.nl/cms/mo ... k=WiwiHome

Downloads are here, sorry for no Linux demo binary yet:
* http://wastebucket.solidsteel.nl/cms/mo ... op=&cid=10

Released under the wxWidgets license.

Supported / tested platforms are:
- Linux
- Windows
- Windows CE (Smartphone and WinCE)

It's unicode / ansi compatible. Enjoy!

I hope this new class will make it easier for beginning wxWidgets users to play around with sizers and make it easy to write GUI's.

With regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Wed Jun 07, 2006 10:50 am

Glad that you finaly released it :)
Just a sidenote: On the screenshot page it says that the last one was taken from Symbian Os. In fact it is Windows Mobile 2003 Smartphone Edition (the CE branch for smartphones).

Anyway: Great work!
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Wed Jun 07, 2006 11:01 am

Hi upCASE,

Fixed! Thanks for pointing that out! And also thank you for some beta testing, compiling and providing me the patches and cool pics how this works on a mobile platform!

I really hope this will give wxWidgets an extra edge over other cross platform toolkits and will become easier to use for (beginning) developers ...

Regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Post by ABX » Wed Jun 07, 2006 12:44 pm

Jorg wrote:Fixed! Thanks for pointing that out!
There is still something... unusual. Smartphone does not have pointing device so wxButton is not supposed to happen (even if it compiles). MS in smartphone dedicated guidelines says "Smartphone applications should never use buttons". And even for PocketPC where buttons are supported there are guidelines to avoid OK, Cancel buttons (use Undo instead of Cancel, and caption corner for OK). This logic is already build into CreateButtonSizer() for wxW 2.7.0 so you can reuse it when your syntax suggest OK/Cancel architecture. Hope this helps!

ABX
CVS Head, 2.8.X
wxMSW, wxWinCE, wxPalmOS, wxOS2, wxMGL, bakefile
gcc 3.2.3, bcc 5.51, dmc 8.48, ow 1.6, vc 7.1, evc 3/4, pods 1.2

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Wed Jun 07, 2006 12:50 pm

Hi ABX!
Thanks for mentioning this, but I allready discussed this with Jorg and state the same things about guidlines :)
The shown example is one of the standard examples for wxGuiBuilder and I didn't modify it, hence the buttons. Using either CreateButtonSizer() or a custom solution using the menu shouldn't be too hard.

Jorg: Do you need some other screenshots? I could have a look at that button issue too, although I suppose only few people here use CE.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

protocol
Moderator
Moderator
Posts: 680
Joined: Wed Jan 18, 2006 6:13 pm
Location: Dallas, TX
Contact:

Post by protocol » Wed Jun 07, 2006 8:16 pm

That's brilliant.
/* UIKit && wxWidgets 2.8 && Cocoa && .Net */
QuRegExmm
wxPCRE & ObjPCRE - Regex It!

Vexator
I live to help wx-kind
I live to help wx-kind
Posts: 187
Joined: Sun Jan 30, 2005 2:50 pm
Location: Heidelberg, Germany

Post by Vexator » Thu Jun 08, 2006 7:31 am

great! :D
just read the docs.. ok so we can assign predefined id's to our controls, but how can we provide custom id's for them? and is there a way to make it work with wxlocale?
Windows 7 Pro
Visual Studio 2010
wxWidgets 2.9.3

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Thu Jun 08, 2006 8:14 am

@upCASE,
Jorg: Do you need some other screenshots? I could have a look at that button issue too, although I suppose only few people here use CE.
Screenshots would be cool, but I am more concerned about what you also mentioned, that for example that windows CE does not handle notebooks well etc. I need to think of some substitute / conditional system that multiple platforms can also be supported easily ... I think I can implement wxButtonSizer which should not be too hard...

@Vexator
ust read the docs.. ok so we can assign predefined id's to our controls, but how can we provide custom id's for them? and is there a way to make it work with wxlocale?
Custom ID's can be done through the reference classes. For example when I want to have ID_SOMETHING for a button, you assign a label to it, and use wxGbButton to assign it like this;

Code: Select all

wxGuiBuilder gb("H{ ['Button']:button }");
gb << wxGbButton("button", NULL, ID_SOMETHING);
This is a custom ID that you assign to a button. Is this what you mean?

And for wxLocale, yes that is still an issue. I can imagine You can use _(" ") inside the string like;

Code: Select all

wxGuiBuilder gb("H{ '" _("This is a static text") + "' }");
This is ofcourse not so elegant. I am open for suggestions on this matter on how to solve wxLocale translations. I know poedit scans the text and catches every _(" ") string, but because the GUI markup is one string, another mechanism needs to be used. Perhaps a callback mechanism for every caption in the GUI markup? As I said, I know ot this issue, but I am still unsure how to solve this.

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Post by ABX » Thu Jun 08, 2006 8:46 am

Jorg wrote:Screenshots would be cool, but I am more concerned about what you also mentioned, that for example that windows CE does not handle notebooks well etc. I need to think of some substitute / conditional system that multiple platforms can also be supported easily ...
I believe that would be reinventing the wheel. wxWidgets is already choosing best book type as wxBookCtrl which is:
- wxChoicebook for Smartphones
- wxNotebook with bottom orientation and flat look for PocketPC
- wxNotebook with top orientation and 3D look for all others
Think about it as most native config in wxConfig or most native help system as wxBestHelp. In other words, using wxBookCtrl with wxBK_DEFAULT style instead of wxNotebook will provide most optimal and native look and feel.

(ps. the pocketpc bottom/flat was discussed in wx-dev but not commited yet)

ABX
CVS Head, 2.8.X
wxMSW, wxWinCE, wxPalmOS, wxOS2, wxMGL, bakefile
gcc 3.2.3, bcc 5.51, dmc 8.48, ow 1.6, vc 7.1, evc 3/4, pods 1.2

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Thu Jun 08, 2006 8:52 am

So you are suggesting I should substitute wxNotebook for wxBookCtrl ?Is the API compatible as far as wxNotebookPage is still the page to be added and AddPage still exists? More then this I don't need..

Regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Thu Jun 08, 2006 9:03 am

Jorg wrote:So you are suggesting I should substitute wxNotebook for wxBookCtrl ?Is the API compatible as far as wxNotebookPage is still the page to be added and AddPage still exists? More then this I don't need..
Hang on a second, allready testing it :)
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Thu Jun 08, 2006 9:16 am

Works charming :)
Just a question: Is there a way I don't see to navigate the pages on Smartphone, else then a menu item?
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Thu Jun 08, 2006 10:53 am

Cool, thanks for your efforts upCASE! If you have other things you would like to see added, I am happily accepting and implementing patches ofcourse!

I already thought about how to implement wxLocale, I think to somehow after parsing dump all captions to a file, which can be read by poEdit.

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Thu Jun 08, 2006 11:59 am

Jorg wrote:Cool, thanks for your efforts upCASE!
No problem, I like the idea of this tool as you know.

Still, there are some problems :)
I tried wxBookCtrl instead of wxNotebook. Charming, charming, thanks ABX for this one. Compiles and runs just fine on Windows, PocketPC and Smartphone.

However, Smartphone is the platform that gives me the creeps because of its limited capabilites regarding GUI navigations and style.
Although the wxChoicebook and all pages show up correctly, I can't navigate them. I tried with the samples, same issue. In the notebook sample a menu item for navigation is added and works correctly. I'm not really sure if this is related to the emulator (I don't trust this thing a bit), but I guess it's the same on a real phone.

I had a look and thought about buttons, too. The idea with CreateButtonSizer is good, but this would only cover wxID_OK/wxID_CANCEL and wxID_YES/wxID_NO combinations. For the other buttons that might be there, another way has to be found.
I toyed a bit and created a solution that would parse everything as usual, but instead of creating a button it creates a simple black panel and adds the "button" to the right menu. I'll try a bit more but it could be an option. Currently I only tried with a dialog, I'll have to check for frames.

The notebook/button combination worries me most. If there are different panels with buttons, only the correct buttons for the active page should be shown in the menu. Maybe I'm making things too complicated.

BTW: Radiobuttons are not supported natively on Smartphone either, as well as listboxes...

Anyway, I'll mail you some new screenshots for PocketPC once I'm done. And I'll see if I can get some nicer looking screenshots for Smartphone as well.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Post by ABX » Thu Jun 08, 2006 12:13 pm

upCASE wrote:I tried wxBookCtrl instead of wxNotebook. Charming, charming, thanks ABX for this one. Compiles and runs just fine on Windows, PocketPC and Smartphone.
BTW: there is small overview about it in manual: http://www.lpthe.jussieu.fr/~zeitlin/wx ... rview.html
upCASE wrote:However, Smartphone is the platform that gives me the creeps because of its limited capabilites regarding GUI navigations and style.
Although the wxChoicebook and all pages show up correctly, I can't navigate them.
Sadly this is known issue and I'm trying to understand it too since months. I feel this is related to tabbing not working between panels but I cannot find it. IIRC current workaround is to force focus movement to first control after page change or something like that. My goal with introducing wxBookCtrl was to avoid crappy #ifdefs in user code but unfortunatelly debugging everything is beyound my free time and commercial target. Believe me or not but I never had WinCE device in hand :( But I offer my cooperation to anybody who wants to solve it nicely. That would be valuable since I work on adjusting reworked widgets sample to work on small screens too.
upCASE wrote:BTW: Radiobuttons are not supported natively on Smartphone either, as well as listboxes...
I didn't know that. Thanks for the info!

ABX
CVS Head, 2.8.X
wxMSW, wxWinCE, wxPalmOS, wxOS2, wxMGL, bakefile
gcc 3.2.3, bcc 5.51, dmc 8.48, ow 1.6, vc 7.1, evc 3/4, pods 1.2

Post Reply