Need Help Getting Started in wxFormBuilder

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
Balrog
In need of some credit
In need of some credit
Posts: 2
Joined: Sat Nov 12, 2016 1:36 pm

Need Help Getting Started in wxFormBuilder

Post by Balrog » Sat Nov 12, 2016 1:59 pm

I recently discovered wxLua and I'm in love with it, despite only having written simple test scripts so far. I run a bunch of game servers and have to change a lot of passwords regularly, so I thought for my first program, to get the hang of wxLua, I'd write a simple random password generator.

Most of the utility programs I've written in the past were made in Visual Basic, and I haven't had to design many layouts programmatically recently, so I thought I'd use wxFormBuilder to get the rough layout, then read though the generated code and figure out how it all works. Problem is, I can't for the life of me figure out how to design any kind of layout other than a few controls in a line. The only video tutorials I could find went into detail about setting up the events, etc., and I was going to do all that by editing the Lua file afterwards; can't find anything that just shows how to do basic layouts.

This is the kind of layout I'm looking to make:
Image

It took a couple of minutes to do that in Visual Basic, so I expected to be able to do it in wxFormBuilder in a few minutes, but I'm dumb apparently.

Could anyone give me some tips on how do basically anything in wxFormBuilder please? :D All I know so far is that I need to start with a frame and then a box spacer.

User avatar
doublemax
Moderator
Moderator
Posts: 13985
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Need Help Getting Started in wxFormBuilder

Post by doublemax » Sat Nov 12, 2016 2:26 pm

In order to achieve that you need to know about "sizers" which is the layout element used in wxWidgets. You don't use absolute positioning, because the sizes of elements can change among different OS or user settings (font size etc).

http://neume.sourceforge.net/sizerdemo/

This is pretty confusing for most new wxWidgets users, but it's worth it.
sizer_layout.png
sizer_layout.png (4.67 KiB) Viewed 1252 times
Green = outer Vertical box sizer
Red = several Horizontal box sizers
Black = stretch spacers - needed to center the elements in between
Cyan = flexgridspacer - needed to make the text boxes align vertically
Use the source, Luke!

Balrog
In need of some credit
In need of some credit
Posts: 2
Joined: Sat Nov 12, 2016 1:36 pm

Re: Need Help Getting Started in wxFormBuilder

Post by Balrog » Sat Nov 12, 2016 4:00 pm

Ah, nice. That looks like exactly what I needed. Thank you very much :)

Edit: Yep, got it exactly how I wanted it now. Thanks again!

Post Reply