Unit 'MUIClass.List' Package
[Overview][Types][Classes][Index] [#MUIClass]

TMUIList.Format

Format the Columns of the List

Declaration

Source position: MUIClass.List.pas line 120

published property TMUIList.Format : string
  read FFormat
  write SetFormat;

Description

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

DELTA
Space in pixel between this column and the next. the last displayed column ignores this setting. Defaults to 4.
PREPARSE
A preparse value for this column. Setting this e.g. to #27'c' would make the column centered. See Text.Contents for other control codes.
WEIGHT
The weight of the column. As with MUI's group class, columns are layouted with a minimum size, a maximum size and weight. A column with a weight of 200 would gain twice the space than a column with a weight of 100. Defaults to 100.
MINWIDTH
Minimum percentage width for the current column. If your list is 200 pixel wide and you set this to 25, your column will at least be 50 pixel. The special value -1 for this parameter means that the minimum width is as wide as the widest entry in this column. This ensures that every entry will be completely visible (as long as the list is wide enough). Defaults to -1.
MAXWIDTH
Maximum percentage width for the current column. If your list is 200 pixel wide and you set this to 25, your column will not be wider as 50 pixel. The special value -1 for this parameter means that the maximum width is as wide as the widest entry in this column. Defaults to -1.
COL
This value adjusts the number of the current column. This allows you to adjust the order of your columns without having to change your display event. See example for details. Defaults to current entry number (0,1,...)
BAR
you can enable a vertical bar between this and the next column by using this switch.

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';

Errors

Currently there is a maximum of 64 columns for a list.

See also

OnDisplay

  

Define what should be printed in a list row

Text.Contents

  

String to be displayed in a text object.


Documentation generated on: 2024-12-22