Format the Columns of the List
Source position: MUIClass.List.pas line 120
published property TMUIList.Format : string |
MUI has the ability to handle multi column lists. To define how many columns should be displayed and how they should be formatted, you specify a format string.
This format string must contain one entry for each column you want to see. Entries are seperated by commas, one entry is parsed via dos.library/ReadArgs().
The template for a single entry looks like this:
DELTA=D/N,PREPARSE=P/K,WEIGHT=W/N,MINWIDTH=MIW/N,MAXWIDTH=MAW/N,COL=C/N,BAR/S
If your list object gets so small there is not enough place for the minwidth of a column, this column will be hidden completely and the remaining space is distributed between the remaining columns. This is not true if the column is the first column, in this case the entries will simply be clipped.
Note: You will have as many columns in your list as entries in the format string (i.e. number of commas + 1). Empty entries, e.g. with a format string of ',,,,' are perfectly ok.
The default list format is an empty string (''), this means a one column list without special formatting.
Examples:
// Three column list without further formatting: List.Format := ',,'; // Three column list, middle column centered: List.Format := ',P='#27'c,'; // Three column list, display order 2 1 0: List.Format := 'COL=2,COL=1,COL=0'; // now something more complex. // the display event defines six entries: procedure TMyWindow.DisplayEvent(Sender: Objectint: PPChar; Entry: PChar); var At: PArticle; begin At := PArticle(Entry); ToPrint[0] := At^.FromName; // col 0 ToPrint[1] := At^.FromPath; // col 1 ToPrint[2] := At^.ToName; // col 2 ToPrint[3] := At^.ToPath; // col 3 ToPrint[4] := At^.Date; // col 4 ToPrint[5] := At^.Subject; // col 5 end; // but we only want to have fromname, date and subject // actually displayed, subject shoud be centered: List.Format := 'COL=0,COL=4,COL=5 P='#27'c'; { maybe this looks kind of silly, why not make our display hook only fill in these three columns. well, if you would e.g. make the format string user configurable and document what your display hook puts into the array, the user could decide what columns he actually wants to see. The supplied example DFView does something like that. two column list: ! Eye 1234 ! ! Foot 22 ! ! Nose 22331 ! } List.Format := 'MAW=100,P='#27'r';
Currently there is a maximum of 64 columns for a list.
|
Define what should be printed in a list row |
|
|
String to be displayed in a text object. |