SDK: "width" property doesn't work with popup menus on Windows with custom display scaling

LEGEND ,
Aug 01, 2022 Aug 01, 2022

Copy link to clipboard

Copied

[I've completely rewritten this bug report -- I originally thought it was a difference between Windows 10 and 11.]

 

On Windows 10 or 11, when a display scale of 150% is set,  the "width" property doesn't work with viewFactory:popup_menu(), making it hard for plugins to align controls.   LR is forgetting to scale the width of the popup menu, whereas it does it correctly for the other LrView controls.  Users often find it necessary to set scaling on high-resolution displays.

 

To reproduce, set a display scale of 150%:

 

johnrellis_3-1659485773323.png

 

Then run the script below.  Here are the results with no custom display scaling and with scaling set to 150%:

johnrellis_0-1659484446045.png johnrellis_4-1659486007315.png

 

With scaling set to 150%, the popup menus with the "width" property are too small. Changing the script to set the popup_menu's width to be 1.5 times the requested width sets them to be the same width as the other controls:

f:popup_menu {items = items, width = 1.5 * pixels}

 

I haven't found an effective workaround.  Using the "width_in_chars" property won't work as a workaround -- it has never given consistent results in any version of LR on either platform, as you can see in the second set of controls in each window.

 

 

local LrDialogs = import "LrDialogs"
local LrView = import "LrView"

local f = LrView.osFactory()

local items = {{title = "Item 1", value = 1}, 
    {title = "Item 2", value = 2}}

local pixels, chars = 120, 10

local controls = f:column {
    spacing = f:control_spacing (),
    f:static_text {title = "width = <pixels>"},
    f:row {
        f:static_text {title = "Heading 1:", width = pixels},
        f:static_text {title = "Heading 2:", width = pixels}},
    f:row {
        f:popup_menu {items = items, width = pixels},
        f:popup_menu {items = items, width = pixels}},
    f:row {
        f:edit_field {width = pixels},
        f:edit_field {width = pixels}},
    f:row {
        f:push_button {title = "Button 1", width = pixels},
        f:push_button {title = "Button 2", width = pixels}},
    f:spacer {height = 2 * f:control_spacing ()},
    f:static_text {title = "width_in_chars = <chars>"},
    f:row {
        f:static_text {title = "Heading 1:", width_in_chars = chars},
        f:static_text {title = "Heading 2:", width_in_chars = chars}},
    f:row {
        f:popup_menu {items = items, width_in_chars = chars},
        f:popup_menu {items = items, width_in_chars = chars}},
    f:row {
        f:edit_field {width_in_chars = chars},
        f:edit_field {width_in_chars = chars}},
    f:row {
        f:push_button {title = "Button 1", width_in_chars = chars},
        f:push_button {title = "Button 2", width_in_chars = chars}}}

local result = LrDialogs.presentModalDialog {
    title = "Width Bug", contents = controls}

 

 

 

TOPICS
SDK , Windows

Views

70

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

Another symptom of popup_menu's failure to observe display scaling: The default height of the control will be too small, resulting in sloppy and ugly layout.

 

Running the script below with scaling set to 150% and 100%:

 

johnrellis_0-1659487081669.png

 

johnrellis_1-1659487170397.png

 

local LrDialogs = import "LrDialogs"
local LrView = import "LrView"

local f = LrView.osFactory()

local controls = f:row {
    f:static_text {title = "Static Text"},
    f:edit_field {value = "Edit Field"},
    f:push_button {title = "Button"},
    f:popup_menu {items = {{title = "Popup Menu", value = 1}}, value = 1},
    f:checkbox {title = "Modified", value = false}}

local result = LrDialogs.presentModalDialog {
    title = "Alignment Bug", contents = controls}

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Thanks for the report.
We are investigating.

 

Thanks,
Sunil

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 12, 2022 Sep 12, 2022

Copy link to clipboard

Copied

LATEST

@SunilBhaskaran, any update as to whether this has been filed internally?  Thanks.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines