Jump to content

UAK: Menu items shrink in width with increasing DPI scale (Windows)


Noridge
 Share

Go to solution Solved by Josh,

Recommended Posts

Hi there,

I recently noticed an issue with the menu items: Their width is shrinking if the DPI scale increases. Its quite prominent as the items' labels are not shown completely anymore. I tested the occurrence of this issue on a 2160p monitor (150% default scale) and a 1080p one (100% default scale) with differenct scales.

For the tests I created a fresh project and used the code from the DPI Scaling tutorial. The mouse hovered over the first menu entry while generating the screenshots for you to see the width of the menu entry relative to the window title. They are ordered by DPI scale (100->125->150->175).

First the 1080p monitor:

1080p_100.png.46abb5b8eeb7d1cba050523d2b9acb07.png1080p_125.png.2b8f38b14b1250d1554d220b8b54aa97.png1080p_150.png.a8561652cbb817aaa8149988ad7c0040.png1080p_175.png.c8df3d975e31ab98fcd7a03b4b492a91.png

 

Second the 2160p monitor:

2160p_100.png.e7fe2dbc1f3c711426e45b099bd3b529.png2160p_125.png.eedd6b4ed53d39d33f9210e3f4bb16a5.png2160p_150.png.b865e614cc217ccc3cc6c9890932f889.png2160p_175.png.b8b9595df423a55ec027ac1cbc62dd94.png

 

Other than that the DPI scaling capabilities of UAK are awesome, especially as there are many software products out there which are totally unable to accomplish something like this. ?

  • Thanks 1
  • Upvote 1
Link to comment
Share on other sites

  • Noridge changed the title to UAK: Menu items shrink in width with increasing DPI scale (Windows)

I noticed that that the text of Panles with style PANEL_GROUP is affected as well. See the screenshots (1080p monitor, scales: 100 -> 125)panel_100.png.b9e77c6309756b771b79812adba525e9.pngpanel_125.png.aa24f86847ec9108aea15984ebcd3673.png

 

Have also a look at the menu items. While the space between them is too big, beginning with the 125 scale the labels are cut off again. It feels more prominent without having the hover-highling like in the screenshots of my previous post.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...
  • Solution

Appears to be working correctly now in Ultra Engine:

image.thumb.png.e7d3046d3112cd41b6097c5b641f7c18.png

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    //Get the displays
    auto displays = GetDisplays();

    //Create a window
    auto window = CreateWindow("Ultra Engine", 0, 0, 800, 600, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE);

    //Create User Interface
    auto ui = CreateInterface(window);

    //Create widget
    auto sz = ui->root->ClientSize();
    auto treeview = CreateTreeView(10, 10, sz.x - 20, sz.y - 20, ui->root, TREEVIEW_DRAGANDDROP | TREEVIEW_DRAGINSERT);
    treeview->SetLayout(1, 1, 1, 1);

    auto node = treeview->root->AddNode("Node 1");
    node->AddNode("Subnode 1");
    node->AddNode("Subnode 2");
    node->AddNode("Subnode 3");

    node = treeview->root->AddNode("Node 2");
    node->AddNode("Subnode 1");
    node->AddNode("Subnode 2");
    node->AddNode("Subnode 3");

    node = treeview->root->AddNode("Node 3");
    node->AddNode("Subnode 1");
    node->AddNode("Subnode 2");
    node->AddNode("Subnode 3");

    ui->SetScale(2);

    while (true)
    {
        const auto& event = WaitEvent();
        switch (event.id)
        {
        case EVENT_WIDGETSELECT:
            if (event.source == treeview and event.data == 1)
            {
                node = event.extra->As<Widget>();
                Print("Selected: " + node->text);
            }
            break;
        case EVENT_WIDGETACTION:
            if (event.source == treeview)
            {
                node = event.extra->As<Widget>();
                Print("Action: " + node->text);
                if (!node->kids.empty())
                {
                    if (node->Collapsed())
                    {
                        node->Expand();
                    }
                    else
                    {
                        node->Collapse();
                    }
                }
            }
            break;
        case EVENT_WIDGETDROP:
        {
            auto child = event.source->As<Widget>();
            auto parent = event.extra->As<Widget>();
            child->SetParent(parent, event.data);
        }
        break;
        case EVENT_WINDOWCLOSE:
            return 0;
            break;
        }
    }
    return 0;
}

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • Josh locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...