wxWidgets behaviour different on 2 computers? Topic is solved

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.
Post Reply
albinoblacksheep
Earned a small fee
Earned a small fee
Posts: 11
Joined: Tue Mar 28, 2017 4:59 pm

wxWidgets behaviour different on 2 computers?

Post by albinoblacksheep »

Hello,

I have written a small prototype in C++ and compiled it on Windows 10 using MinGW32.

While the program works as intended on my PC the program behaves different on a second machine (Windows 10 as well):

On my PC the textCtrl are textCtrl while the textCtrl on the other machine appears as sliders:

Please look at the images. What could cause that a compiled program displays on the one machine the textCtrl correctly while on the second machine sliders instead of txtCtrl?

Regards
albinoblacksheep
Attachments
second_machine.PNG
second_machine.PNG (12.24 KiB) Viewed 1971 times
my_machine.PNG
my_machine.PNG (70.17 KiB) Viewed 1971 times
catalin
Moderator
Moderator
Posts: 1618
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: wxWidgets behaviour different on 2 computers?

Post by catalin »

Those are not sliders, but scrollbars.
How do you create a wxTextCtrl? Are you using wxTE_MULTILINE or wxHSCROLL or wxTE_DONTWRAP ?
albinoblacksheep
Earned a small fee
Earned a small fee
Posts: 11
Joined: Tue Mar 28, 2017 4:59 pm

Re: wxWidgets behaviour different on 2 computers?

Post by albinoblacksheep »

Thank you for looking into this.

Indeed wxTE_DONTWRAP was set (the others not). So I build a new version for testing and will report if this fixes it. Interesting is that I have another ListBox (different name and on a different Tab) where the problem does not occur.

For my better understanding: If I select wxTE_DONTWRAP why this could cause having a scrollbar? Multiline and HSCROLL sounds logic that this might result in a scrollbar, but DONTWRAP? The textCtrl is long enough to ensure that the string fits into.

This is how the textCtrls are created:

Code: Select all

    jg_id = new wxTextCtrl(Panel9, ID_TEXTCTRL17, wxEmptyString, wxPoint(136,16), wxSize(152,27), wxTE_DONTWRAP, wxDefaultValidator, _T("ID_TEXTCTRL17"));
    jg_status = new wxTextCtrl(Panel9, ID_TEXTCTRL18, wxEmptyString, wxPoint(136,64), wxSize(152,27), wxTE_READONLY, wxDefaultValidator, _T("ID_TEXTCTRL18"));
    jg_designation = new wxTextCtrl(Panel9, ID_TEXTCTRL19, wxEmptyString, wxPoint(136,112), wxSize(152,27), wxTE_READONLY, wxDefaultValidator, _T("ID_TEXTCTRL19"));
    jg_latitude = new wxTextCtrl(Panel9, ID_TEXTCTRL20, wxEmptyString, wxPoint(136,160), wxSize(152,27), wxTE_READONLY, wxDefaultValidator, _T("ID_TEXTCTRL20"));
    jg_longitude = new wxTextCtrl(Panel9, ID_TEXTCTRL21, wxEmptyString, wxPoint(136,208), wxSize(152,27), wxTE_READONLY, wxDefaultValidator, _T("ID_TEXTCTRL21"));
    jg_distance = new wxTextCtrl(Panel9, ID_TEXTCTRL22, wxEmptyString, wxPoint(136,256), wxSize(152,27), wxTE_READONLY, wxDefaultValidator, _T("ID_TEXTCTRL22"));
and this is how they get filled

Code: Select all

// Select infos from DB and put them into ListBox
        sql << "SELECT name FROM info order by NAME;";
    ListBox1->InsertItems(getListBoxContent(sql), 0);
        sql.clear();
        sql.str("");
        sql << "SELECT designation FROM entry UNION ALL SELECT designation FROM exit ORDER BY designation;";
    ListBox2->InsertItems(getListBoxContent(sql), 0);
        sql.clear();
        sql.str("");
catalin
Moderator
Moderator
Posts: 1618
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: wxWidgets behaviour different on 2 computers?

Post by catalin »

albinoblacksheep wrote:If I select wxTE_DONTWRAP why this could cause having a scrollbar?
I believe wxTextCtrl docs answer that question.
However, you do not need that style for a single line text ctrl.

How do you know the text control is long enough? You cannot see the text because of the scrollbar. Beside, that flag forces the showing of the scrollbar, see the docs.


Off topic: you should not use explicit sizes and positions, but use sizer-based layout. You will find very good docs and tutorials about it.
albinoblacksheep
Earned a small fee
Earned a small fee
Posts: 11
Joined: Tue Mar 28, 2017 4:59 pm

[solved] Re: wxWidgets behaviour different on 2 computers?

Post by albinoblacksheep »

Thank you for your advise. We can mark the topic as solved.
catalin
Moderator
Moderator
Posts: 1618
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: [solved] Re: wxWidgets behaviour different on 2 computers?

Post by catalin »

albinoblacksheep wrote:We can mark the topic as solved.
In the top-right corner of every reply there is a checkmark button with the tooltip "Accept this answer". You can click that button for the reply you consider it solved the problem.
User avatar
doublemax
Moderator
Moderator
Posts: 19161
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWidgets behaviour different on 2 computers?

Post by doublemax »

you should not use explicit sizes and positions, but use sizer-based layout.
This is probably the main problem. I guess the other computer you tested on had a different font scaling and therefore the hard-coded sizes were too small and you ended up with scrollbars.
Use the source, Luke!
Post Reply