Multiple problems in wxWidgets Layout Application

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
bgining2this
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed Mar 03, 2021 9:24 pm

Multiple problems in wxWidgets Layout Application

Post by bgining2this »

Could someone give me several advice? For example how do i develop the layout of a application? i do it with the Frame maximized at development? How can i set a size for the textctrls and statictext and all the other controls, in my app when i have a radiogroup with 3 choices the control is big, so it overlapps the space of the next control, how can i solve that problem? i have added a sizer (wxVERTICAL) and to it a gridsizer so i can place controls in ALL the frame, if you need it i will post here my Project. Thank you in advance
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Multiple problems in wxWidgets Layout Application

Post by ONEEYEMAN »

Hi,
1. Do you use any RAD tool?
2. If yes - do you modify its generated code?
3. Can you post the code you use and the screenshot of what the code is doing?

Thank you.
bgining2this
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed Mar 03, 2021 9:24 pm

Re: Multiple problems in wxWidgets Layout Application

Post by bgining2this »

RAD tool ? Sorry i dont know the difference i use wxDatePicker several times, i am developing all from the code, i am not using wxcrafter heres my Project and a image when i run my application, the frame shows minimized or i dont know very little, even thought i have set its size to 1100 and 680 when i create the frame,
DentalOrganizerNew.zip
My Project
(885.76 KiB) Downloaded 56 times
DentalOrganizerNew.zip
My Project
(885.76 KiB) Downloaded 56 times
Attachments
A screenshot when i run the application
A screenshot when i run the application
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Multiple problems in wxWidgets Layout Application

Post by doublemax »

Are you using MDI on purpose? It's very unusual and i don't think it fits your use case very well.

Code: Select all

MainFrame::MainFrame(wxWindow* parent,
    wxWindowID id,
    const wxString& title,
    const wxPoint& pos,
    const wxSize& size,
    long style)
    : wxMDIParentFrame(parent, id, title)    
{
The mainframe opens small, because the size you pass to the constructor is not passed through to the base constructor of wxMDIParentFrame
Use the source, Luke!
bgining2this
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed Mar 03, 2021 9:24 pm

Re: Multiple problems in wxWidgets Layout Application

Post by bgining2this »

Yes, its a MDI application, but now if i place controls and the window gets smaller, how can i make the controls proportional to the frame new size? Thank you i didnt noticed the constructor problem, how can i make the panels bigger? With its constructor ? Sorry im new to wxWidgets
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Multiple problems in wxWidgets Layout Application

Post by doublemax »

i place controls and the window gets smaller, how can i make the controls proportional to the frame new size?
You want to scale everything down when the size gets smaller? Not easily possible and - given the nature of the application - not the right thing to do anyway. The best thing to do is to set the minimum size of the window so that it's guaranteed that all controls are visible. To do that, in the cHistorialMedico constructor, replace this->SetSizer(sizer); with this->SetSizerAndFit(sizer);
Use the source, Luke!
bgining2this
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed Mar 03, 2021 9:24 pm

Re: Multiple problems in wxWidgets Layout Application

Post by bgining2this »

Oh now i understand, thank you, and the height of the wxtextctrl also in the constructor of the text control?
bgining2this
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed Mar 03, 2021 9:24 pm

Re: Multiple problems in wxWidgets Layout Application

Post by bgining2this »

I cannot complete my project as it is, for example the height of the textctrls is very big, how can i modify my layout ?
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Multiple problems in wxWidgets Layout Application

Post by doublemax »

In a wxGridSizer all cells have the same size, determined by the biggest cell. You probably don't want that here, replace it with a wxFlexGridSizer.

And when you add wxTextCtrls into the sizer, don't set the wxEXPAND flag.
Use the source, Luke!
bgining2this
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed Mar 03, 2021 9:24 pm

Re: Multiple problems in wxWidgets Layout Application

Post by bgining2this »

I have modified my project, but now a big control makes all the column very big, how can i make only the column of the big control grow?
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Multiple problems in wxWidgets Layout Application

Post by doublemax »

Can you show a screenshot?
Use the source, Luke!
bgining2this
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed Mar 03, 2021 9:24 pm

Re: Multiple problems in wxWidgets Layout Application

Post by bgining2this »

Heres the screenshot, as you can see in the last row a control has lots of text and makes the whole column bigger, is it possible to configure just only his row?
Attachments
This is a screenshot of my app right now
This is a screenshot of my app right now
app.png (69.27 KiB) Viewed 1231 times
Peter H
In need of some credit
In need of some credit
Posts: 9
Joined: Fri Mar 12, 2021 12:29 pm

Re: Multiple problems in wxWidgets Layout Application

Post by Peter H »

I think you can increase the gridbag sizer column or row span to a value larger than 1 for this label, so it will use more than one column or/and row.
and/or by inserting "\n" to the text label you can make it a multiline textlabel.
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Multiple problems in wxWidgets Layout Application

Post by doublemax »

I don't think you will be able to solve this (and make it look good and efficient to use) with a single wxGridSizer. E.g. you should group related items together and put them in a wxStaticBoxSizer.

Do you have a paper form this GUI is based on? If yes, can you show it?
Use the source, Luke!
bgining2this
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed Mar 03, 2021 9:24 pm

Re: Multiple problems in wxWidgets Layout Application

Post by bgining2this »

It is for a application i have developed but in Visual Basic heres a screenshot showing the app running
Attachments
A part of my Application in Visual Basic
A part of my Application in Visual Basic
Post Reply