Scaling and 4K displays

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
Nunki
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 235
Joined: Fri Sep 14, 2012 8:26 am
Location: Kontich, Belgium
Contact:

Scaling and 4K displays

Post by Nunki »

Hi all,
I recently encountered the problem on windows that win10 with the ability to scale the screen content to 125% or more, some of the screen elements in my application were smaller than the text in it. With the use of High DPI awareness flag in the manifest file I was able to counter this problem on my win10 test station. However I now tested the application on a 4K display and found that the same problem seem to re-arise. Have some of you had the same problem , do I need to do something extra to solve this ?

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

Re: Scaling and 4K displays

Post by doublemax »

No. On a 4k display the scaling factor is probably much higher, but in principle setting the dpi-awareness should be enough if you don't use hardcoded coordinates or sizes anywhere.
Use the source, Luke!
Nunki
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 235
Joined: Fri Sep 14, 2012 8:26 am
Location: Kontich, Belgium
Contact:

Re: Scaling and 4K displays

Post by Nunki »

The point I do not understand here is when the DPI awareness should handle this, as I can see when on win10 I use the 125% or even 175% scaling in windows. The wxGrid stays the same an all other things. But on a 4K screen, a simple window with buttons (sizes all set to -1 or default) results in those buttons being half as high as the other controls.
Aanmelden.png
Aanmelden.png (12.22 KiB) Viewed 3119 times
regards,
Nunki
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Scaling and 4K displays

Post by doublemax »

I don't see anything wrong on that screenshot. Also, this looks a lot like Windows 7, not Windows 10.
Use the source, Luke!
Nunki
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 235
Joined: Fri Sep 14, 2012 8:26 am
Location: Kontich, Belgium
Contact:

Re: Scaling and 4K displays

Post by Nunki »

That's right, it is a win7 screenshot (I'll try to get hold of the 4K screenshot of the same window). I only tried to say, this window displays fine on win7 and win10, even with scaling to 175%, but on win10 100% scaling and a 4K screen, the cancel and ok button are only about half that height, thus showing only half of the text. All other objects are correct if I well remember.

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

Re: Scaling and 4K displays

Post by doublemax »

Maybe there is still a bug in the size calculation, do you see the same problem in any of the wx samples?

If not, can you provide some sample code that shows the problem?
Use the source, Luke!
Nunki
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 235
Joined: Fri Sep 14, 2012 8:26 am
Location: Kontich, Belgium
Contact:

Re: Scaling and 4K displays

Post by Nunki »

Ok, I'll try and gather code and some screenshots of all situations, but that will be for tuesday I gather.

Regards,
Nunki
Nunki
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 235
Joined: Fri Sep 14, 2012 8:26 am
Location: Kontich, Belgium
Contact:

Re: Scaling and 4K displays

Post by Nunki »

Hi guys,

I finally have some additional information on the problem. First I use xrc files created by dialogblocks for displaying the frames (mdi child frames that is)

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<resource version="2.3.0.1" xmlns="http://www.wxwidgets.org/wxxrc">
    <object class="wxMDIChildFrame" name="ID_AANMELDEN" subclass="Aanmelden">
        <style>wxCAPTION|wxTAB_TRAVERSAL</style>
        <bg>#E0E0E0</bg>
        <size>300,200</size>
        <title>Aanmelden</title>
        <font>
            <size>8</size>
            <family>swiss</family>
            <face>Tahoma</face>
        </font>
        <object class="wxPanel" name="ID_PANEL25">
            <style>wxSUNKEN_BORDER|wxTAB_TRAVERSAL</style>
            <object class="wxBoxSizer">
                <orient>wxVERTICAL</orient>
                <object class="spacer">
                    <flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag>
                    <border>5</border>
                    <size>5,5</size>
                </object>
                <object class="sizeritem">
                    <flag>wxGROW|wxLEFT|wxRIGHT</flag>
                    <border>5</border>
                    <object class="wxBoxSizer">
                        <orient>wxHORIZONTAL</orient>
                        <object class="sizeritem">
                            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                            <border>5</border>
                            <object class="wxStaticText" name="wxID_STATIC">
                                <size>70,-1</size>
                                <style>wxALIGN_RIGHT</style>
                                <label>Database:</label>
                            </object>
                        </object>
                        <object class="sizeritem">
                            <flag>wxALIGN_CENTER_VERTICAL|wxALL|wxFIXED_MINSIZE</flag>
                            <border>2</border>
                            <option>1</option>
                            <object class="wxChoice" name="LOGON_DB">
                            </object>
                        </object>
                    </object>
                </object>
                <object class="sizeritem">
                    <flag>wxGROW|wxLEFT|wxRIGHT</flag>
                    <border>5</border>
                    <object class="wxBoxSizer">
                        <orient>wxHORIZONTAL</orient>
                        <object class="sizeritem">
                            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                            <border>5</border>
                            <object class="wxStaticText" name="wxID_STATIC">
                                <size>70,-1</size>
                                <style>wxALIGN_RIGHT</style>
                                <label>Bedrijf:</label>
                            </object>
                        </object>
                        <object class="sizeritem">
                            <flag>wxALIGN_CENTER_VERTICAL|wxALL|wxFIXED_MINSIZE</flag>
                            <border>2</border>
                            <option>1</option>
                            <object class="wxChoice" name="LOGON_BDRF">
                            </object>
                        </object>
                    </object>
                </object>
                <object class="sizeritem">
                    <flag>wxGROW|wxLEFT|wxRIGHT</flag>
                    <border>5</border>
                    <object class="wxBoxSizer">
                        <orient>wxHORIZONTAL</orient>
                        <object class="sizeritem">
                            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                            <border>5</border>
                            <object class="wxStaticText" name="wxID_STATIC">
                                <size>70,-1</size>
                                <style>wxALIGN_RIGHT</style>
                                <label>Login:</label>
                            </object>
                        </object>
                        <object class="sizeritem">
                            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                            <border>2</border>
                            <option>1</option>
                            <object class="wxTextCtrl" name="LOGON_USR">
                            </object>
                        </object>
                    </object>
                </object>
                <object class="sizeritem">
                    <flag>wxGROW|wxLEFT|wxRIGHT</flag>
                    <border>5</border>
                    <object class="wxBoxSizer">
                        <orient>wxHORIZONTAL</orient>
                        <object class="sizeritem">
                            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                            <border>5</border>
                            <object class="wxStaticText" name="wxID_STATIC">
                                <size>70,-1</size>
                                <style>wxALIGN_RIGHT</style>
                                <label>Paswoord:</label>
                            </object>
                        </object>
                        <object class="sizeritem">
                            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                            <border>2</border>
                            <option>1</option>
                            <object class="wxTextCtrl" name="LOGON_PWD">
                                <style>wxTE_PASSWORD</style>
                            </object>
                        </object>
                    </object>
                </object>
                <object class="sizeritem">
                    <flag>wxGROW|wxALL</flag>
                    <border>0</border>
                    <object class="wxBoxSizer">
                        <orient>wxHORIZONTAL</orient>
                        <object class="spacer">
                            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                            <border>5</border>
                            <size>70,5</size>
                        </object>
                        <object class="sizeritem">
                            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                            <border>2</border>
                            <object class="wxCheckBox" name="LOGON_AUTO">
                                <label>Autologin</label>
                                <checked>0</checked>
                            </object>
                        </object>
                    </object>
                </object>
                <object class="sizeritem">
                    <flag>wxGROW|wxALL</flag>
                    <border>5</border>
                    <object class="wxBoxSizer">
                        <orient>wxHORIZONTAL</orient>
                        <object class="sizeritem">
                            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                            <border>2</border>
                            <object class="wxButton" name="wxID_CANCEL">
                                <label>Annuleer</label>
                            </object>
                        </object>
                        <object class="spacer">
                            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                            <border>5</border>
                            <option>1</option>
                        </object>
                        <object class="sizeritem">
                            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                            <border>2</border>
                            <object class="wxButton" name="wxID_OK">
                                <style>wxWANTS_CHARS</style>
                                <label>Aanmelden</label>
                                <default>1</default>
                            </object>
                        </object>
                    </object>
                </object>
            </object>
        </object>
    </object>
</resource>
This results in de screen as displays above on win7 or 10 even with scaling up to 175%. However on win10 with a 4K display it shows as this..
aanlogscherm.PNG
aanlogscherm.PNG (6.1 KiB) Viewed 3048 times
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Scaling and 4K displays

Post by doublemax »

Looks to me like the controls are ok, just the dialog is too small.
What happens if you manually increase the size of the dialog?

What's the scaling value on the machine with 4K display?
Use the source, Luke!
Post Reply