ListBrowser layout question
Post date
Tue, 06/10/2025 - 07:19
I'm currently giving the final touches to the MultiRename
tool which I've been working on for some time. It uses a ListBrowser in a very prominent position in the main window. Here's a
I would like to change the three columns so that the left column, “State”, has the minimum required size and the other two columns, “Old name” and “New name”, share the remaining space.
Currently the ListView
ist set up like this:
...
LAYOUT_AddChild, m_ppGadgets[GID_LBR_PROCESSING_LIST] = NewObject(LISTBROWSER_GetClass(), NULL,
GA_ID, GID_LBR_PROCESSING_LIST,
GA_RelVerify, TRUE,
LISTBROWSER_AutoFit, TRUE,
LISTBROWSER_ColumnInfo, (ULONG)m_pColumnInfo,
LISTBROWSER_ColumnTitles, TRUE,
LISTBROWSER_HorizontalProp, TRUE,
LISTBROWSER_TitleClickable, TRUE,
TAG_DONE),
...
and m_pColumnInfo
created like:
m_pColumnInfo = AllocLBColumnInfo(3,
LBCIA_Column, 0,
LBCIA_Sortable, FALSE,
LBCIA_Title, "State",
LBCIA_Column, 1,
LBCIA_AutoSort, TRUE,
LBCIA_SortArrow, TRUE,
LBCIA_SortDirection, LBMSORT_FORWARD,
LBCIA_Title, "Old name",
LBCIA_Column, 2,
LBCIA_Sortable, FALSE,
LBCIA_Title, "New name",
TAG_DONE);
In the Autodocs it reads, that columns are weighted by default, and so far I have not made any other setting.
So, how to change it for the first column to get the width that it needs and the other two columns share the remaining space 50/50?
Online Status
Unfortunately LISTBROWSER_AutoFit applies to the entire listbrowser. You could define the left column as CIF_FIXED and calculate the width you need for it using TextExtent() or similar.The other two columns could be left as weighted columns and share half the remaining space.