Skip to content

pyui.set_column_min_width

fabian-flassig edited this page Aug 17, 2026 · 1 revision

Sets a minimum width for one or several layout columns. The column is then never narrower than the given width, even if the controls it contains would fit into less space. Use it to keep input fields or list columns readable when their content is short.

pyui.set_column_min_width(dialog, columns, width)
dialog:set_column_min_width(columns, width)

Parameters

Type Description
dialog dialog_handle Dialog whose layout columns are addressed
columns integer or {...} Column index or table of integer column indices
width number Minimum width in dialog units (DLU). 0 removes the requirement.

Return value

None

Note

Widths are given in dialog units rather than pixels, so they scale with the dialog font and with the display scaling (DPI) of the dialog. Four horizontal DLU correspond to roughly the width of one character, so a width of 40 reserves space for about ten characters.

The value is a lower bound only. A column still grows beyond it when its controls need more space, and it is still expanded according to set_column_stretch when the dialog is wider than its natural width.

Set the minimum before the dialog is laid out. If a column width is changed on an already visible dialog, call update_dialog_layout afterwards.

Example:

function open_dialog()
    local dialog = pyui.create_dialog("my_plugin_dialog")
    dialog:set_window_title("Part data")

    dialog:create_label(1, "Name")
    dialog:create_text_box(2)
    dialog:create_label(1, "Comment")
    dialog:create_text_box(2)

    -- keep the input column wide enough for about 30 characters
    dialog:set_column_min_width(2, 120)

    dialog:create_ok_button(1)
    dialog:create_cancel_button(2)
    pyui.run_modal_dialog(dialog)
end

Version Support:

Minimum PYTHA Version: V27

The function is absent (nil) in older versions, so a plugin can probe for it with if pyui.set_column_min_width then ... end.

See also

Control Gallery, Dialog Layout, set_column_stretch, equalize_column_widths, set_control_min_height, update_dialog_layout

Clone this wiki locally