-
Notifications
You must be signed in to change notification settings - Fork 18
pyui.set_control_min_height
Sets a minimum height for a single control. The control is then never shorter than the given height, even if its natural height would be smaller. Typical uses are enlarging a create_list_box or a create_text_area that has to show more than a few entries, giving a create_thumbnail_preview more room, or making a prominent action button two or three lines tall.
pyui.set_control_min_height(control, height)
control:set_control_min_height(height)| Type | Description | |
|---|---|---|
control |
control_handle |
Control handle |
height |
number |
Minimum height in dialog units (DLU). 0 removes the requirement. |
None
Heights are given in dialog units rather than pixels, so they scale with the dialog font and with the display scaling (DPI) of the dialog. Eight vertical DLU correspond to roughly one line of text, so a height of 80 is about ten lines.
The value is a lower bound only: a control is never made smaller than the height the dialog layout determines for it, so a value below its natural height has no effect. Only the control itself is enlarged, the remaining layout is unaffected.
Set the minimum directly after creating the control. If it is applied to a control of an already visible dialog, call update_dialog_layout afterwards.
function open_dialog()
local dialog = pyui.create_dialog("my_plugin_dialog")
dialog:set_window_title("Select part")
local list = dialog:create_list_box(1)
list:insert_control_item("Door")
list:insert_control_item("Drawer")
list:insert_control_item("Shelf")
-- about 15 lines instead of the default height
list:set_control_min_height(120)
dialog:create_ok_button(1)
pyui.run_modal_dialog(dialog)
endMinimum PYTHA Version: V27
The function is absent (nil) in older versions, so a plugin can probe for it with if pyui.set_control_min_height then ... end.
Control Gallery, Dialog Layout, set_column_min_width, create_list_box, create_text_area, set_control_icon, update_dialog_layout