Unit SortGrid |
***************************************************************************** Class: TSortGrid Copyright © 1996 Author: Bill Menees bmenees@usit.net www.public.usit.net/bmenees Modified by Eric W. Engler, Feb 1997 - fixed a bug in autodetection of type - OnBeginSort event was called before the autodetect of type; moved to after. - expanded date sort to incl datetime (these are usu compatible in Delphi) - added a time sort IMPORTANT! Do NOT use Delphi's "Break on Exception" option if you run a program that uses this component from the Delphi GUI. This VCL uses exceptions during normal processing.
Classes |
TSortedList -
TSortGrid - Here's the main new class: TSortGrid
Functions |
DateTimeCompare -
NumericCompare -
Register - I put TSortGrid on the 'Additional' page because I like having it with the other grids.
StringCompare -
TimeCompare -
Types |
PSortedListEntry
TBeginSortEvent
TCellBevel
TCellBevelStyle
TCellValidateEvent
TClickSortEvent
TEndSortEvent
TFormatDrawCellEvent
TFormatOptions
TSizeChangedEvent
TSortCompare
TSortDirection
TSortedListEntry
TSortOptions
TSortStyle
TUpdateGridEvent
TVertAlignment
Constants |
Variables |
Functions |
Types |
PSortedListEntry = ^TSortedListEntry
TBeginSortEvent = procedure(Sender: TObject; Col: Longint; var SortOptions: TSortOptions) of object
TCellBevel = record********************************************************} {*** NOTE: This is one of the structures in TFormatOptions.
Style : TCellBevelStyle;
UpperLeftColor : TColor;
LowerRightColor : TColor;
end;
TCellBevelStyle = (cbNone, cbRaised, cbLowered);
TCellValidateEvent = procedure(Sender: TObject; Col, Row: Longint; var Value: String; var Valid: Boolean) of object
TClickSortEvent = procedure(Sender: TObject; Col, Row: Longint; var SortOptions: TSortOptions) of object
TEndSortEvent = procedure(Sender: TObject; Col: Longint) of object
TFormatDrawCellEvent = procedure(Sender: TObject; Col, Row: Longint; State: TGridDrawState; var FormatOptions: TFormatOptions) of objectThese are the new events defined for TSortGrid.
TFormatOptions = record************************************************} {*** NOTE: These are the display options you can set for each cell in OnGetCellFormat.
Brush : TBrush;
Font : TFont;
AlignmentHorz : TAlignment;
AlignmentVert : TVertAlignment;
Bevel : TCellBevel;
HideText : Boolean;
end;
TSizeChangedEvent = procedure(Sender: TObject; OldColCount, OldRowCount: Longint) of object
TSortCompare = function (const Str1, Str2: String): IntegerTSortCompare must return < 0 if Str1 is less than Str2, 0 if they are equal, and > 0 if Str1 is greater than Str2.
TSortDirection = (sdAscending, sdDescending);
TSortedListEntry = recordUsed only if SortStyle = ssCustom.
Str : String;
RowNum : Longint;
end;
TSortOptions = record************************************************************} {*** NOTE: These are the options you can set to affect sorting.
SortStyle : TSortStyle;
SortDirection : TSortDirection;
SortCaseSensitive : Boolean;
SortCompare : TSortCompare;
end;
TSortStyle = (ssAutomatic, ssAlphabetic, ssNumeric, ssDateTime, ssTime,ssCustom);
TUpdateGridEvent = procedure(Sender: TObject; Index: Longint) of object
TVertAlignment = (taTopJustify, taBottomJustify, taMiddle);
Constants |
Variables |