Using wxSizers on high dpi, positions the widgets differently then on low dpi
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
Hi,
Why do you want to hardcode anything? Its ugly and it breaks!!
Use sizers - they will make life soooo much easier!!
Thank you.
Why do you want to hardcode anything? Its ugly and it breaks!!
Use sizers - they will make life soooo much easier!!
Thank you.
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
Thats because I need to either change the width or height for a widget.
I am trying to use sizers >:(
My "wxCheckListBox" could have different items in it for different executions , so if it had over 100 items in it , the "wxCheckListBox" would become so big that it would go past the screen , thats why I need a fixed size. So in this case they don't make life easier .
Can't there be a class like wxSize , but it corresponds to the same size on every major platform. For Example , some like a "wxGenericSize".
I am trying to use sizers >:(
My "wxCheckListBox" could have different items in it for different executions , so if it had over 100 items in it , the "wxCheckListBox" would become so big that it would go past the screen , thats why I need a fixed size. So in this case they don't make life easier .
Can't there be a class like wxSize , but it corresponds to the same size on every major platform. For Example , some like a "wxGenericSize".
Last edited by ibrahim on Wed May 25, 2022 2:33 pm, edited 1 time in total.
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
Hi,
No you don't.
You may think that you do because you are coming from the M$ paradigm that everything has to be hardcoded.
Now, there is no layout that can not be coded with sizers.
All you need to remember is - sizers use minimal size to lay out control and it is their best size.
Thank you.
P.S.: If you can show me a layout where a size has to be hardcoded, I will buy you a beer...
No you don't.
You may think that you do because you are coming from the M$ paradigm that everything has to be hardcoded.
Now, there is no layout that can not be coded with sizers.
All you need to remember is - sizers use minimal size to lay out control and it is their best size.
Thank you.
P.S.: If you can show me a layout where a size has to be hardcoded, I will buy you a beer...
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
Is setting the minimal size gonna destory cross-platform safety ?????????
Is the minimal size gonna be different on every platform ???????
Thats what I asked since the beginning , I'm not understanding how this best size stuff is related to what I asked.
I need to use a minimal size , so thats why I'm asked this question
Is the minimal size gonna be different on every platform ???????
Thats what I asked since the beginning , I'm not understanding how this best size stuff is related to what I asked.
I need to use a minimal size , so thats why I'm asked this question
Last edited by ibrahim on Wed May 25, 2022 2:43 pm, edited 1 time in total.
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
Hi,
Can you explain in plain English why do you insist on hardcoding position/size?
Using sizers is so much easier and pain free...
No modern toolkit does it.
Thank you.
Can you explain in plain English why do you insist on hardcoding position/size?
Using sizers is so much easier and pain free...
No modern toolkit does it.
Thank you.
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
PLEASE READ MY ENTIRE POST
I am not hardcoding the position
This is what would happen is I just carelessly let the sizer get the best size for the wxCheckListBox :
Also Is setting the SetMaxSize() count as hardcoding , doublemax told me to use it to decrease the widgets size.
I'm using SetMinSize() to increase the widgets size ( Opposite of SetMaxSize() ) .
Also have you read my post where I mention "wxGenericSize" , where the size passed in corresponds to the same size of every platform.
I'm not hardcoding any position , I'm letting the wxFlexGridSizer take care of that for me
Is using SetMaxSize() hardcoding ?? Is using SetMinSize() hardcoding ?? if yes then how do I change the size using those functions.
I am not hardcoding the position
This is what would happen is I just carelessly let the sizer get the best size for the wxCheckListBox :
If your saying its possible to change the width and height of a widget without hardcoding the sizes , why don't you tell me how ??My "wxCheckListBox" could have different items in it for different executions , so if it had over 100 items in it , the "wxCheckListBox" would become so big that it would go past the screen , thats why I need a fixed size. So in this case they don't make life easier .
Also Is setting the SetMaxSize() count as hardcoding , doublemax told me to use it to decrease the widgets size.
I'm using SetMinSize() to increase the widgets size ( Opposite of SetMaxSize() ) .
Also have you read my post where I mention "wxGenericSize" , where the size passed in corresponds to the same size of every platform.
I'm not hardcoding any position , I'm letting the wxFlexGridSizer take care of that for me
Is using SetMaxSize() hardcoding ?? Is using SetMinSize() hardcoding ?? if yes then how do I change the size using those functions.
- doublemax@work
- Super wx Problem Solver
- Posts: 474
- Joined: Wed Jul 29, 2020 6:06 pm
- Location: NRW, Germany
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
I think you already have all the information you need. Sometimes it's necessary to limit the size of a control for UX reasons, and you can use SetMaxSize() to do that. E.g. for the checklistbox, only limit the height, so that the control can still grow in its width direction.
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
Okay , I've changed the wxCheckListBox to only limit the height that and It works , Thanks for all the help, ONEYEEMAN made me think all of this sizer stuff was for nothing . I'll try to solve the third question myself
Edit :
I've solved the third question myself , thanks for helping me , I'll accept your latest post as the answer
Edit 2 :
For some reason , on high dpi the font is smaller , all the sizes are correct , but the font is smaller.
Edit :
I've solved the third question myself , thanks for helping me , I'll accept your latest post as the answer
Edit 2 :
For some reason , on high dpi the font is smaller , all the sizes are correct , but the font is smaller.
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
Hi,
In this case the control will display the scroll bar and the user will scroll to the items (s)he needs.
So you don't need to hardcode anything - use sizers with wxDefaultPosition/wxDefaultSize.
Let the library decide the appropriate size and if something will not fit - the scroll bar will be shown.
In your case - the best size for the wxCheckListBox I thinkl is the same as with the wxListBox - 10 items high and maximum string width.
Keep in mind though that if you have other controls on the right of wxCLB, the width of it will be decreased to accommodate the other controls.
If you for some unknown reason (I still would like to know what this reason is) wants a different BEST SIZE you create a child of the control and override the DoGetBestSize() virtual function.
And yes - using SetXXXSize() is considered hardcoding as you are using static numbers for the parameters.
And you shouldn't play with setting size at all. Just let the sizers do their job - they are good at it.
Now, since you are not familiar with the sizers - why don't you try to get wxGlade, wxCrafter or wxFormBuilder and p[lay with the RAD tool.
Try to create a layout, generate a code and see what it produce.
I guarantee you will not be needing it after couple of tries...
Thank you.
That is fine.ibrahim wrote: ↑Wed May 25, 2022 2:45 pm PLEASE READ MY ENTIRE POST
I am not hardcoding the position
This is what would happen is I just carelessly let the sizer get the best size for the wxCheckListBox :
My "wxCheckListBox" could have different items in it for different executions , so if it had over 100 items in it , the "wxCheckListBox" would become so big that it would go past the screen , thats why I need a fixed size. So in this case they don't make life easier .
In this case the control will display the scroll bar and the user will scroll to the items (s)he needs.
So you don't need to hardcode anything - use sizers with wxDefaultPosition/wxDefaultSize.
Let the library decide the appropriate size and if something will not fit - the scroll bar will be shown.
In your case - the best size for the wxCheckListBox I thinkl is the same as with the wxListBox - 10 items high and maximum string width.
Keep in mind though that if you have other controls on the right of wxCLB, the width of it will be decreased to accommodate the other controls.
If you for some unknown reason (I still would like to know what this reason is) wants a different BEST SIZE you create a child of the control and override the DoGetBestSize() virtual function.
Can you explain what" wxGenericSize" is? I never heard of it before..ibrahim wrote: ↑Wed May 25, 2022 2:45 pm If your saying its possible to change the width and height of a widget without hardcoding the sizes , why don't you tell me how ??
Also Is setting the SetMaxSize() count as hardcoding , doublemax told me to use it to decrease the widgets size.
I'm using SetMinSize() to increase the widgets size ( Opposite of SetMaxSize() ) .
Also have you read my post where I mention "wxGenericSize" , where the size passed in corresponds to the same size of every platform.
However, I strongly advise you not to do that. It is portable, but the default sizes are reasonable and fit 99.999999999% of the applications (see my question above).
And yes - using SetXXXSize() is considered hardcoding as you are using static numbers for the parameters.
And you shouldn't play with setting size at all. Just let the sizers do their job - they are good at it.
Now, since you are not familiar with the sizers - why don't you try to get wxGlade, wxCrafter or wxFormBuilder and p[lay with the RAD tool.
Try to create a layout, generate a code and see what it produce.
I guarantee you will not be needing it after couple of tries...
Thank you.
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
Hi,
Is 10 items not enough? Or is it too much?
Remember - if the size is not fit in the screen, scroll bar will appear.
And if you are really, really, really need to display 5 items by default in the wxCLB - use the way
I explained in my previous reply.
And which control is experiencing the issue?
Thank you.
My question is - why do you want to liomit the height of wxCLB?
Is 10 items not enough? Or is it too much?
Remember - if the size is not fit in the screen, scroll bar will appear.
And if you are really, really, really need to display 5 items by default in the wxCLB - use the way
I explained in my previous reply.
For the font issue - are you using 3.1.5 or 3.1.6?
And which control is experiencing the issue?
Thank you.
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
I am using wxWidgets 3.1.6 and the font problem is with the wxStaticText
I don't know how many items could appear in the checklistbox. My application has an extension support , so if the user gets an extension then the number of items in the wxCheckListBox would change. By default 10 items appear in the wxCheckListBox , I've only done 6 items so far
I don't know how many items could appear in the checklistbox. My application has an extension support , so if the user gets an extension then the number of items in the wxCheckListBox would change. By default 10 items appear in the wxCheckListBox , I've only done 6 items so far
Last edited by ibrahim on Wed May 25, 2022 5:07 pm, edited 1 time in total.
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
Hi,
You are using DPI aware v2 in the manifest?
Do you see the same when you build, i.e. widgets sample?
What resolution is your monitor set on?
Thank yuo.
You are using DPI aware v2 in the manifest?
Do you see the same when you build, i.e. widgets sample?
What resolution is your monitor set on?
Thank yuo.
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
What manifest ? I am getting high dpi under Visual Studio by going toYou are using DPI aware v2 in the manifest?
Propeties -> Configuration Propeties -> Manifest Tool -> Input and Output -> DPI awarness
I haven't checkedDo you see the same when you build, i.e. widgets sample?
1080p resolutionWhat resolution is your monitor set on?
wxGenericSize isn't a thing , I just said could that be added to wxWidgets 3.2.0
Edit :
Hey ONEEYEMAN, I tried to remove the "SetMinSize()" for the wxCheckListBox and it actually does display a scroll bar. The only problem is that is displays the scroll bar after I add a LOT of items , how do I limit the number of items before it displays a scroll bar.
Better yet , can I choose how big I want my wxCheckListBox to be, based on the number of items I want there to be ?? and if the number of items in the checkbox exceeds the number I chose for the wxCheckListBox , it would automatically display a scroll bar ???
I only get to know whats going in the checklistbox until runtime
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
Hi,
Is you monitor set for 100, 150 or 200 DPI?
I understand you are an ESL person - I'm the same,
But you need to understand - Software Development is like math. You should be as precise as possible.
Now, if I understand you correctly, what you are looking for is:
1. Start the dialog wxCLB is empty. The control height should have enough height to accommodate X number of items.
2. You user adds some Y items to the control. The control is not resized.
3. Your user adds Z number of items to the control. The control is not resized, instead the scroll bar appears.
4. The control still have X number of items displayed.
Did I explained your scenario correctly?
And you are looking for a way to set the X?
If that is true - use the technique I already told you about: subclass the control and override its DoGetBestSize() function.
You can actually open the code for this control and grab its own DoGetBestSize() implementation, modify it and place it in
your subclass,
If that's not the scenario/problem you are looking for - please explain/correct.
Now, I think that for wxCLB the parameters are as follows:
For an empty control the height is big enough to accommodate 3 items. For the one filled up, scroll bar appears after 11 item is added.
Now, those numbers aer the default for wxListBox/wxListCtrl. But I think they are applicable for the wxCLB as well.
It is pretty reasonable.
Thank you.
Yes, good.
Well, you should.
My question was actually incorect, sorry.
Is you monitor set for 100, 150 or 200 DPI?
As you probably already know from the DM sample, it is called wxDefaultSize.
OK, you need to give me an exact scenario here.ibrahim wrote: ↑Wed May 25, 2022 5:12 pm Edit :
Hey ONEEYEMAN, I tried to remove the "SetMinSize()" for the wxCheckListBox and it actually does display a scroll bar. The only problem is that is displays the scroll bar after I add a LOT of items , how do I limit the number of items before it displays a scroll bar.
I understand you are an ESL person - I'm the same,
But you need to understand - Software Development is like math. You should be as precise as possible.
Now, if I understand you correctly, what you are looking for is:
1. Start the dialog wxCLB is empty. The control height should have enough height to accommodate X number of items.
2. You user adds some Y items to the control. The control is not resized.
3. Your user adds Z number of items to the control. The control is not resized, instead the scroll bar appears.
4. The control still have X number of items displayed.
Did I explained your scenario correctly?
And you are looking for a way to set the X?
If that is true - use the technique I already told you about: subclass the control and override its DoGetBestSize() function.
You can actually open the code for this control and grab its own DoGetBestSize() implementation, modify it and place it in
your subclass,
If that's not the scenario/problem you are looking for - please explain/correct.
You mean the content of the control is known only DURING run-time?ibrahim wrote: ↑Wed May 25, 2022 5:12 pm Better yet , can I choose how big I want my wxCheckListBox to be, based on the number of items I want there to be ?? and if the number of items in the checkbox exceeds the number I chose for the wxCheckListBox , it would automatically display a scroll bar ???
I only get to know whats going in the checklistbox until runtime
Now, I think that for wxCLB the parameters are as follows:
For an empty control the height is big enough to accommodate 3 items. For the one filled up, scroll bar appears after 11 item is added.
Now, those numbers aer the default for wxListBox/wxListCtrl. But I think they are applicable for the wxCLB as well.
It is pretty reasonable.
Thank you.
Re: Using wxSizers on high dpi, positions the widgets differently then on low dpi
I was reading the docs , and its saying that its more preferable to override DoGetBestClientSize() , I don't know so i'm gonna override DoGetBestSize()
I guess I can just do that
I guess I can just do that
Last edited by ibrahim on Thu May 26, 2022 8:56 am, edited 1 time in total.