Page 1 of 1

wxDialog Executable Size Does Not Match Preview

Posted: Thu Jun 15, 2017 10:10 pm
by ColleenKobe
Hi. I have two problems with my wxDialog display. I have put a marked-up printscreen of my IDE and execution below for your reference.
Vertically Challenged display.jpg
1. The first problem is that the executable's screen size is too short vertically to display all the fields. I have left all the "Size" fields for the wxPanel and wxSizer boxes as -1,-1, and the preview pane looks beautiful. See the printscreen above. But the actual executable form is too wide horizontally and too short vertically. And I can't grab the sides to widen or shrink the panel.

As I state in the markup: In practice, only one of the three equations visible in the preview page would be shown at a time. Each equation would start in the same spot, which is just below the cyan box.

2. The second problem that I'm having trouble displaying wxStaticText and wxTextCtrl boxes. Again, they look great in the preview pane, but they're jumbled all on top of each other in the executable. This problem may fix itself when problem #1 is fixed, but I'm not sure.

To get the wxDialog box the right size, I have tried changing the size and minimum size of the wxPanel to values like 800,800, then generated code, cleaned the workspace, rebuilt the workspace, and finally run the program. But the wxDialog screen size is the same as it was when I set it to -1,-1.

Can someone give me suggestions of flags to set, or reset, or give me an idea where to start, to make the wxDialog bigger vertically?
Currently, the only flags I have set for the wxDialog are wxDEFAULT_DIALOG_STYLE and wxFULL_REPAINT_ON_RESIZE.

I thank you in advance for your help.


Software Versions
CodeLite 10.0.4
gcc 4.9.3
Windows 10 Pro, 64-bit
wxWidgets 3.1.0
wxCrafter 2.6

Target platform 32-bit
Target build debug

Re: wxDialog Executable Size Does Not Match Preview

Posted: Thu Jun 15, 2017 10:58 pm
by eranif
Its hard to tail what the problem is without experimenting with the actual UI.
Try uploading the wxcp file so I can have a look


Re: wxDialog Executable Size Does Not Match Preview

Posted: Thu Jun 15, 2017 11:51 pm
by ColleenKobe
I've added a fourth equation and the vertical problem is worse. But maybe it'll be easier to track down the issue. :-)

Thank you!!!


Re: wxDialog Executable Size Does Not Match Preview

Posted: Fri Jun 16, 2017 12:21 am
by eranif
Tbh, you are just abusing the sizers :D
Too many sizers, you pick wxGridSizer in cases where all you need is wxBoxSizer.

As a general rules:
- If you need more than one column, than go with wxFlexGridSizer
- If you need to align items in a single row or column - go with wxBoxSizer
- Avoid setting hard coded sizes, always use -1,-1 as the size

I doubt that you will need other sizer types.

* I removed some of the wxGridSizer and replaced them with wxBoxSizer and moved some sizers around
* I added a single wxBoxSizer as the "main sizer" for the dialog
* The buttons-sizer is a direct child of the main sizer

Attached is the modified wxcp file, you should be able to pick it from there.

Re: wxDialog Executable Size Does Not Match Preview

Posted: Fri Jun 16, 2017 12:38 am
by ColleenKobe
Hi, Eran,

Thanks for your quick response!

Thank you also for the general rules about sizers. It's good to have them. I used a lot of sizers in order to get the formatting on the page that I needed. None of my usual text formatting methods (left-justify, center, right-justify, etc) work here. I can justify the SIZER, but not the text within the sizer.

I guess it's time to simplify my formatting.

I take no offense about abusing the sizers. I'm learning on my own without a teacher or book, but with (thank heavens!) this web site and others to get answers from. I expect to make some mistakes along the way.

Thank you again, Eran!!! You and your team (? I assume you didn't do it all alone) have done a fantastic job putting all this code and all these environments (wxCrafter, wxWidgets, CodeLite) together!