How to proper alighn widgets Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
maximand
Experienced Solver
Experienced Solver
Posts: 62
Joined: Fri Nov 11, 2011 5:44 pm
Location: Russia

How to proper alighn widgets

Post by maximand » Mon Apr 29, 2019 7:01 am

Hello,
I have an issue with dialog on Linux. Weekday name is displayed outside the transaction dialog's border
And wxChoice widgets are smaller than other widgets in the transaction dialog:
l1.PNG
l1.PNG (30.43 KiB) Viewed 149 times

The same dialog on Windows OS looks nice
w1.PNG
w1.PNG (25.34 KiB) Viewed 149 times

The code:
https://github.com/moneymanagerex/money ... g.cpp#L398

Please advice how to fix?
M$, VS2017, C++

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

Re: How to proper alighn widgets

Post by doublemax » Mon Apr 29, 2019 7:44 am

I guess this the problem.

Code: Select all

itemStaticTextWeek_ = new wxStaticText(this, wxID_STATIC, "");
This text is initially empty and the dialog is big enough for that. But when you change this text, you must re-Layout() the sizer and adjust the dialog size.

But it wouldn't look nice if the size of the dialog changes, each time the user changes the date. So maybe it's better to just reserve a size that's guaranteed to be big enough for all days/translations.
Use the source, Luke!

maximand
Experienced Solver
Experienced Solver
Posts: 62
Joined: Fri Nov 11, 2011 5:44 pm
Location: Russia

Re: How to proper alighn widgets

Post by maximand » Tue Apr 30, 2019 5:26 am

doublemax, thank you.

We have implemented this hack:

Code: Select all

    //Text field for name of day of the week
    wxSize WeekDayNameMaxSize(wxDefaultSize);
    for (wxDateTime::WeekDay d = wxDateTime::Sun;
            d != wxDateTime::Inv_WeekDay;
            d = wxDateTime::WeekDay(d+1))
        WeekDayNameMaxSize.IncTo(GetTextExtent(
            wxGetTranslation(wxDateTime::GetEnglishWeekDayName(d))));

    itemStaticTextWeek_ = new wxStaticText(this, wxID_STATIC, "",
        wxDefaultPosition, WeekDayNameMaxSize, wxST_NO_AUTORESIZE);
M$, VS2017, C++

Post Reply