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%:
Then run the script below. Here are the results with no custom display scaling and with scaling set to 150%:
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}
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%:
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}
Copy link to clipboard
Copied
Thanks for the report.
We are investigating.
Thanks,
Sunil