Need Directions Placing Controls on a Form

Post here wxCrafter related issues / features / bugs
User avatar
ColleenKobe
CodeLite Expert
Posts: 130
Joined: Wed Mar 30, 2016 4:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Need Directions Placing Controls on a Form

Post by ColleenKobe »

Hi! I'm trying to re-create the following form. It was originally written in Visual Basic 6.
Comm Interface.jpg
I have figured out how to create the "Com Port" radio button column. I have put a "Refresh" button below it, but the button is not inside the radio button box. I hope my project engineer can live with that.

Now I'm trying to add the "Enable Com Interface" checkbox, the Communication Port Status text, the Temporary File Path text dialog, and the Browse button on the page. I am at a loss. What happens is that I have the first sizer set up on the page to be vertical, so anything I add later on is appended to the bottom of the screen. If I change it to Horizontal, then EVERYTHING appends to the right.

What I really want is for the new group of controls to be beside the radio buttons field.

I think the wxFlexGrid sizer might work. I just need to figure out how to put more than one control in the right frame of the sizer. See the picture below.
Comm Interface Failure Screen Shot.jpg
Can you please tell me how to put the checkbox, text box, text label and box, and refresh button, all in the sizer area to the right of the radio buttons, so that they match the original drawing more?

Thanks!!!

Colleen

------------------
Software Versions:
------------------
CodeLite = 9.1.6
g++ = 4.9.3
tdm-g++ = 5.1.0.3
Windows 7 = 6.1
wxCrafter = 2.5
wxWidgets = 3.1.0
You do not have the required permissions to view the files attached to this post.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Need Directions Placing Controls on a Form

Post by eranif »

It all about playing with the sizers
See attached wxcp file that shows how to get the desired form:
com-form.png
You should really do some reading on how wxSizers are working (there are various types of sizers)
Eran
You do not have the required permissions to view the files attached to this post.
Make sure you have read the HOW TO POST thread
User avatar
ColleenKobe
CodeLite Expert
Posts: 130
Joined: Wed Mar 30, 2016 4:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Need Directions Placing Controls on a Form

Post by ColleenKobe »

Hi, Eran,

WOW! This is fabulous! Thank you so much for giving me this example! I work far better from a good example than from lists of tools. An example shows me how to put the pieces together to get a specific result. Like a jigsaw puzzle. I can use this code in my current project, and it will be a wonderful reference in the future for me. THANK YOU!

In answer to your suggestion that I read up on sizers--you are right. I have read up on sizers, but obviously not enough.

My big problem is that I can't see the sizers. I know I can set the various flags in the Styles and Sizer Flags tabs for controls, and I have seen how the value those flags affect the controls. Even so, I can't tell how wide the sizers are (as opposed to the controls), or how tall, or what percentage of the screen they take up.

Currently, I'm visualizing sizers in my head like Microsoft Word tables, and each cell is a sizer, and I'm trying to insert and move things around in the cells. But if the cell sizes vary, and I can't see where they are on this blank page, then I likely don't put controls in the right places.

Is there a way to turn sizer viewing on? So I can see them all the time?

Colleen
marcelinux
CodeLite Enthusiast
Posts: 17
Joined: Mon Nov 02, 2015 3:26 pm
Genuine User: Yes
IDE Question: C++
Location: Spain
Contact:

Re: Need Directions Placing Controls on a Form

Post by marcelinux »

Can I sugest you a review of http://zetcode.com/gui/wxwidgets/layoutmanagement/
It helped me to understand sizers.
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Need Directions Placing Controls on a Form

Post by DavidGH »

Hi,
Is there a way to turn sizer viewing on?
It's permanently on. Just select a sizer in the tree view; as in the screenshot it should be outlined in a tasteful orange.
It's not 100% reliable, and there's a tendency for one edge to be missed, as in the screenshot; but it usually works well enough.
So I can see them all the time?
No, that would be too 'busy', and conflict with the outlining of the controls.

Another good place to learn about wxBoxSizers is http://neume.sourceforge.net/sizerdemo/.

Regards,

David
You do not have the required permissions to view the files attached to this post.
Post Reply