Midware TMWTable.FieldLayout

From Overbyte
Jump to navigation Jump to search

Main page -> Midware component reference -> TMWTable -> FieldLayout

Definition

property FieldLayout: TFieldLayout;

Description

FieldLayout property is used to describe columns content. It is a string made of semi-colon separated list of data. There is three items per column. First item is column name, second item is column data type, third item is colmun width.

Data types are designated by keywords (See FieldTypesNames above) or single letter for compatibility with old version ('C' -> 'Char', 'D' -> 'Date', 'N' -> 'Numeric', 'F' -> 'Float', 'L' -> 'Boolean'). It is not recommended to use those single letter data types. Data types keywords correspond to stnadard Delphi TFieldType data type. Conversion is as per table FieldTypesOrdinals above.

You don't need to know the string representation if you use the object inspector at design time because there is a property editor that let you design the field layout interactively. You need to use string representaion at runtime if you wants to load/save it from/to an ini file or the registry or transport it from the application server to your client application.

FieldLaout value may be different from what is really stored inside TMWBuffer. Non existant fields will be empty, extra fields will not be shown. TMWTable can't always accurately show TMWBuffer content because TMWBuffer has a variable structure: number of fields may vary from record to record and field length can be anything from 0 bytes to several megabytes while a TMWTable present records with fixed number of fields each one of fixed size.

Const

<syntaxhighlight lang="delphi"> FieldTypesOrdinals : array [0..12] of TFieldType =

    (ftString, ftInteger, ftSmallInt, ftWord,     ftDateTime,
     ftDate,   ftTime,    ftFloat,    ftCurrency, ftBoolean,
     ftBlob,   ftMemo,    ftGraphic);
 FieldTypesNames : array [0..12] of String =
    ('Char', 'Integer', 'SmallInt', 'Word',     'DateTime',
     'Date', 'Time',    'Float',    'Currency', 'Boolean',
     'Blob', 'Memo',    'Graphic');

</syntaxhighlight>