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
wxWidgets behaviour different on 2 computers? Topic is solved
-
- Earned a small fee
- Posts: 11
- Joined: Tue Mar 28, 2017 4:59 pm
wxWidgets behaviour different on 2 computers?
- Attachments
-
- second_machine.PNG (12.24 KiB) Viewed 1970 times
-
- my_machine.PNG (70.17 KiB) Viewed 1970 times
Re: wxWidgets behaviour different on 2 computers?
Those are not sliders, but scrollbars.
How do you create a wxTextCtrl? Are you using wxTE_MULTILINE or wxHSCROLL or wxTE_DONTWRAP ?
How do you create a wxTextCtrl? Are you using wxTE_MULTILINE or wxHSCROLL or wxTE_DONTWRAP ?
-
- Earned a small fee
- Posts: 11
- Joined: Tue Mar 28, 2017 4:59 pm
Re: wxWidgets behaviour different on 2 computers?
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:
and this is how they get filled
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"));
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("");
Re: wxWidgets behaviour different on 2 computers?
I believe wxTextCtrl docs answer that question.albinoblacksheep wrote:If I select wxTE_DONTWRAP why this could cause having a scrollbar?
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.
-
- Earned a small fee
- Posts: 11
- Joined: Tue Mar 28, 2017 4:59 pm
[solved] Re: wxWidgets behaviour different on 2 computers?
Thank you for your advise. We can mark the topic as solved.
Re: [solved] Re: wxWidgets behaviour different on 2 computers?
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.albinoblacksheep wrote:We can mark the topic as solved.
Re: wxWidgets behaviour different on 2 computers?
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.you should not use explicit sizes and positions, but use sizer-based layout.
Use the source, Luke!