wxDialog Size Problem

Post here wxCrafter related issues / features / bugs

wxDialog Size Problem

Postby ColleenKobe » Fri Mar 09, 2018 5:09 pm

This is a small issue, but I would like to fix it.

I have a wxDialog box that I have initialized to being 310x260 pixels, as shown in the screen shot below.

DC.jpg


Time after time, I've done the following:

1. Click the Generate Code button;

2. Select Build, Rebuild Workspace;

3. Select Build, Run,

4. Bring up the wxDialog. And it looks like the tall, skinny window in the picture below:

DC2.jpg


I can fuss around with it to make it look more like the preview picture, and it stays that way the rest of the execution (because of Windows Persistency). But it would just be better if I didn't have to.

What am I doing wrong?

I'm using CodeLite v12.0.0.
Windows 10, 64 bit
MinGW

Thanks!
Colleen
You do not have the required permissions to view the files attached to this post.
ColleenKobe
CodeLite Veteran
 
Posts: 76
Joined: Wed Mar 30, 2016 4:31 pm

Re: wxDialog Size Problem

Postby marcelinux » Sat Mar 10, 2018 11:03 am

You need a wxPanel. I think.
marcelinux
CodeLite Enthusiast
 
Posts: 12
Joined: Mon Nov 02, 2015 3:26 pm
Location: Spain

Re: wxDialog Size Problem

Postby ColleenKobe » Tue Mar 27, 2018 12:36 am

marcelinx, thanks for replying.

Can you please give me more information? Why does the wxFrame need to be a wxPanel? I have two other wxFrames in this program and they behave perfectly. What would be different about having a wxPanel vs. a wxFrame?

I did try adding a wxPanel to the wxFrame. I moved the text box into the wxPanel, but it wouldn't allow wxBoxSizers or wxStaticTextFields in the wxPanel. But the wxFrame still displayed incorrectly, too wide.

I've struggled with this problem for a couple of weeks now. I've cleaned the workspace, re-generated code, and rebuilt the workspace. I've studied the code in wxcrafter.cpp, and verified the code there for the wxFrames that WORK matches the wxFrame that doesn't work. I've gone over my own code with a fine-tooth comb. I've verified that the style settings for the too-wide wxFrame are identical to the settings for the wxFrames that work. I've verified that every control's wxExpand sizer flag is OFF.

I even deleted the existing code for this one wxFrame and REBUILT it, and the page STILL opens WAY too big in one direction. Except now, instead of being tall and skinny, the first time the wxFrame is displayed, it's WAY too WIDE, and spans across both of my two-monitor computer setup.

I just don't know where else to look!

Here is wxcrafter.cpp:
wxcrafter.cpp


And here is the code for the Eq_Digital_Count_Base_Class:
Eq_Digital_Count_Class.cpp
You do not have the required permissions to view the files attached to this post.
ColleenKobe
CodeLite Veteran
 
Posts: 76
Joined: Wed Mar 30, 2016 4:31 pm

Re: wxDialog Size Problem

Postby DavidGH » Tue Mar 27, 2018 1:23 pm

Hi,
Can you please give me more information? Why does the wxFrame need to be a wxPanel?

See this wx FAQ

I had a quick look at the code you attached and can't see any glaringly obvious cause. But that's not surprising when there's so much irrelevant stuff in the files. I suggest that you create a minimal compilable project that demonstrates the problem. That's for two reasons:
    1) It allows other people to test the code, make changes and see the results.
    2) While you are making it minimal, test as you remove each piece of code; you may suddenly find the problem has disappeared, in which case...

Regards,

David
DavidGH
CodeLite Plugin
 
Posts: 517
Joined: Wed Sep 03, 2008 7:26 pm

Re: wxDialog Size Problem

Postby ColleenKobe » Tue Mar 27, 2018 5:54 pm

DavidGH, thanks for replying, and thanks for the link. I read what it said in https://wiki.wxwidgets.org/WxFAQ#Why_do ... it_size.3F

I'm still not clear on the difference(s) between a wxFrame and a wxDialog. I read the answers under "What's the difference between a wxFrame and a wxDialog?" on the same page as the link you gave me. As I read it, the difference is just in how the wxFrame or wxDialog is USED: a wxDialog is acts as a pop-up modal window that won't release control until the user closes it, whereas a wxFrame can be that via the wxSTAY_ON_TOP flag, or not.

So the difference between the two boils down to behavior that could be modified by setting a couple of flags. Good to know.

Anyway, your link helped solve my problem. I created a new wxDialog to replace the malfunctioning wxFrame. The contents of the wxDialog are identical to the malfunctioning wxFrame. But the wxDialog displays correctly, at the size I specified. Again, good to know.

Thank you!!!!!

Colleen
ColleenKobe
CodeLite Veteran
 
Posts: 76
Joined: Wed Mar 30, 2016 4:31 pm

Re: wxDialog Size Problem

Postby DavidGH » Tue Mar 27, 2018 7:26 pm

While a program can have multiple wxFrames, the standard paradigm is a single frame with any other top-level windows being wxDialogs. Those are frequently modal, but can instead be modeless e.g. for a palette of tools.

I'm glad it's fixed. However I'm confused about the whole topic:
I created a new wxDialog to replace the malfunctioning wxFrame.

It's not obvious why a wxFrame would malfunction and a replacement wxDialog not, but wasn't the initial post was about a wxDialog, not a frame?
DavidGH
CodeLite Plugin
 
Posts: 517
Joined: Wed Sep 03, 2008 7:26 pm


Return to wxCrafter

Who is online

Users browsing this forum: No registered users and 2 guests