Class TrStringGridEd

Unit

Declaration

type TrStringGridEd = class(TStringGrid)

Description

enhanced TStringGrid component which introduce Columns property for setting and storing of properties for each column

Hierarchy

  • TStringGrid
  • TrStringGridEd

Overview

Methods

Public procedure BeginUpdate(UseChangeLog: boolean = false);
Public procedure EndUpdate;
Public function InplaceEditorEx: TrStringGridEdInplaceEdit;
Public function IsValidData(ACol, ARow: longint): TrStringGridEdDataState;
Public function GetDataType(ACol, ARow: longint): TrStringGridEdDataType; virtual;
Public function GetDataAlignment(ACol, ARow: longint): TAlignment; virtual;
Public function GetEditStyleEx(ACol, ARow: longint): TrStringGridEdEditStyle; virtual;
Public function GetNumFormat(ACol, ARow: longint): string; virtual;
Public procedure GetCellStyle(ACol, ARow: longint; ACanvas: TCanvas);
Public function CellInSelectedRange(ACol, ARow: longint): boolean;
Public procedure ClearSelRange;
Public function CopySelRange: string;
Public procedure PasteSelRange(CanExpandGrid: boolean; const PasteData: string = '');
Public function CopyEntireTable(IncludingFixedRows: boolean = true; IncludingFixedColumns: boolean = true; Separator: string = #9): string;
Public procedure PasteEntireTable(CanExpandGrid: boolean; const PasteData: string = '');
Public procedure ClearEntireTable(IncludingFixedCells: boolean = false);
Public procedure SaveToFile(const FileName: string; Encoding: TEncoding = nil; Separator: string = #9);
Public procedure LoadFromFile(const FileName: string; SkipAllChecks: boolean = false; Encoding: TEncoding = nil; Separator: string = #9);
Public function FindIniRow(const IniKey: string): longint;
Public function SaveToIniFile(const IniFileName: string; Encoding: TEncoding = nil): string;
Public procedure LoadFromIniFile(const IniFileName: string; const IniFileContent: string = ''; Encoding: TEncoding = nil);
Public procedure LoadValuesFromIniFile(const IniFileName: string; const IniFileContent: string = ''; Encoding: TEncoding = nil);
Public function IsIniGroupRow(ARow: longint): boolean;
Public procedure SetColumnAutoFit(ColIdx: longint);
Public procedure SetColumnsAutoFit;
Public function GetColumnDataWidth(ColIdx: longint; MaxRowsToTest: longint = 10000): integer; virtual;
Public procedure DoEllipsisClick;
Public procedure FinishEditing;
Public procedure ResetChangeLog;
Public function ActiveCellText: string;
Public function IsRowEmpty(ARow: longint; SkipFixedCol: boolean = true; ColumnGroup: integer = 0): boolean;
Public procedure SelectFirstCell(minCol: longint = 0; minRow: longint = 0);
Public procedure MoveRowEx(FromIndex, ToIndex: longint);
Public procedure InsertRowEx(RowIndex: longint; NumberOfRows: integer = 1; Activate: boolean = true);
Public procedure DeleteRowEx(RowIndex: longint; NumberOfRows: integer = 1);
Public procedure MoveColumnEx(FromIndex, ToIndex: longint);
Public procedure InsertColumnEx(ColIndex: longint; NumberOfCols: integer = 1; Activate: boolean = true);
Public procedure DeleteColumnEx(ColIndex: longint; NumberOfCols: integer = 1);
Public procedure SortData(ColIndex: integer; Desc: boolean = false; ResetSelection: boolean = false);

Properties

Public property ScaleRatio: double read FScaleRatio;
Public property MouseDownCoord: TGridCoord read MDownCoord;
Public property MouseDownCellPoint: TPoint read MDownCellPoint;
Public property StringCells[ACol,ARow:longint]: string read GetStringCells write SetStringCells;
Public property NumCells[ACol,ARow:longint]: double read GetNumCells write SetNumCells;
Public property IntCells[ACol,ARow:longint]: integer read GetIntCells write SetIntCells;
Public property BoolCells[ACol,ARow:longint]: boolean read GetBoolCells write SetBoolCells;
Public property DateTimeCells[ACol,ARow:longint]: TDateTime read GetDateTimeCells write SetDateTimeCells;
Public property SelectedRange: TGridRect read GetSelectedRange write SetSelectedRange;
Public property IniValues[constIniKey:string]: string read GetIniValue write SetIniValue;
Public property ChangedRows: TStrings read FChangedRows;
Public property ChangedCells: TStrings read FChangedCells;
Public property RichTextTopMargin: integer read FRichTextTopMargin write SetRichTextTopMargin;
Public property TextApostrophe: char read FTextApostrophe write FTextApostrophe;
Published property CustomGlyphs: TrCustomGlyphs read FCustomGlyphs write SetCustomGlyphs;
Published property OptionsEx: TOptionsEx read FOptionsEx write SetOptionsEx default[];
Published property ColCount: longint read GetColCount write SetColCount default 5;
Published property Columns: TrStringGridEdColumns read FColumns write FColumns;
Published property IniKeyColumn: integer read FIniKeyColumn write FIniKeyColumn default 0;
Published property IniValueColumn: integer read FIniValueColumn write FIniValueColumn default 1;
Published property InnerMargin: integer read FInnerMargin write SetInnerMargin default 0;
Published property TitleRowHeight: integer read FTitleRowHeight write SetTitleRowHeight default 0;
Published property AutoRowHeight: boolean read FAutoRowHeight write SetAutoRowHeight default false;
Published property AutoRowMaxHeight: integer read FAutoRowMaxHeight write FAutoRowMaxHeight default 0;
Published property AutoAddNewRow: boolean read FAutoAddNewRow write SetAutoAddNewRow default false;
Published property ChangedCellsBkColor: TColor read FChangedCellsBkColor write SetChangedCellsBkColor default clInfoBk;
Published property SelectedCellBkColor: TColor read FSelectedCellBkColor write SetSelectedCellBkColor default clNone;
Published property InRangeCellsBkColor: TColor read FInRangeCellsBkColor write SetInRangeCellsBkColor default clNone;
Published property CustomEditorCreate: TCustomEditorCreate read FCustomEditorCreate write FCustomEditorCreate;
Published property CustomEditorEvent: TCustomEditorEvent read FCustomEditorEvent write FCustomEditorEvent;
Published property OnDrawCellBackground: TDrawCellEvent read FOnDrawCellBackground write FOnDrawCellBackground;
Published property OnGetHintText: TGetHintText read FGetHintText write FGetHintText;
Published property OnCellClick: TFixedCellClickEvent read FOnCellClick write FOnCellClick;
Published property OnEllipsisClicked: TrStringGridEdCellEvent read FOnEllipsisClicked write FOnEllipsisClicked;
Published property OnPicklistDropdown: TrStringGridEdDropdownEvent read FOnPicklistDropdown write FOnPicklistDropdown;
Published property OnEditorEvent: TrStringGridEdEditorEvent read FOnEditorEvent write FOnEditorEvent;
Published property OnGetCellParams: TGetCellParamsEvent read FOnGetCellParams write FOnGetCellParams;
Published property OnGetCellParamsEx: TGetCellParamsEventEx read FOnGetCellParamsEx write FOnGetCellParamsEx;
Published property OnGetDataType: TGetDataTypeEvent read FOnGetDataType write FOnGetDataType;
Published property OnGetNumFormat: TGetNumFormat read FOnGetNumFormat write FOnGetNumFormat;
Published property OnGetEditStyle: TGetEditStyleEvent read FOnGetEditStyle write FOnGetEditStyle;
Published property OnCanEdit: TCanEditEvent read FOnCanEdit write FOnCanEdit;
Published property OnFinishCellEditing: TrStringGridEdCellEvent read FOnFinishCellEditing write FOnFinishCellEditing;
Published property OnEditorKeyPress: TKeyPressEvent read FOnEditorKeyPress write FOnEditorKeyPress;
Published property OnColumnRestoreDefault: TOnColumnRestoreDefault read FOnColumnRestoreDefault write FOnColumnRestoreDefault;
Published property OnGetEllipsisButtonFormat: TGetEllipsisButtonFormat read FOnGetEllipsisButtonFormat write FOnGetEllipsisButtonFormat;
Published property OnProgress: TOnProgress read FOnProgress write FOnProgress;
Published property OnGeneralEvent: TGeneralEvent read FOnGeneralEvent write FOnGeneralEvent;

Description

Methods

Public procedure BeginUpdate(UseChangeLog: boolean = false);

start updating of the cell data - blocks refreshing after each update, call EndUpdate after all updates

Public procedure EndUpdate;

finish updating of the cell data, call after all updates if BeginUpdate is used

Public function InplaceEditorEx: TrStringGridEdInplaceEdit;

access to internal inplace editor

Public function IsValidData(ACol, ARow: longint): TrStringGridEdDataState;

return state of data in cell - empty, ok, invalid, outoflimit

Public function GetDataType(ACol, ARow: longint): TrStringGridEdDataType; virtual;

return type of data in cell - text, int, double, datetime

Public function GetDataAlignment(ACol, ARow: longint): TAlignment; virtual;

return alignment of data in cell

Public function GetEditStyleEx(ACol, ARow: longint): TrStringGridEdEditStyle; virtual;

return edit style of data in cell

Public function GetNumFormat(ACol, ARow: longint): string; virtual;

return numeric format of data in cell

Public procedure GetCellStyle(ACol, ARow: longint; ACanvas: TCanvas);

set Canvas style for data in cell

Public function CellInSelectedRange(ACol, ARow: longint): boolean;

return whether cell is inside of range select

Public procedure ClearSelRange;

clear content of selected range

Public function CopySelRange: string;

copy selected range to clipboard, columns are separated by TABs and prepared to paste in Excel

Public procedure PasteSelRange(CanExpandGrid: boolean; const PasteData: string = '');

paste values from clipboard to cells starting by selected cell (columns separated by TABs)

Public function CopyEntireTable(IncludingFixedRows: boolean = true; IncludingFixedColumns: boolean = true; Separator: string = #9): string;

copy entire table to clipboard, returns clipboard text

Public procedure PasteEntireTable(CanExpandGrid: boolean; const PasteData: string = '');

paste values from clipboard to grid from cell 0,0 (columns separated by TABs)

Public procedure ClearEntireTable(IncludingFixedCells: boolean = false);

clear all cells

Public procedure SaveToFile(const FileName: string; Encoding: TEncoding = nil; Separator: string = #9);

store entire table to file, columns are separated by TABs and prepared for using in Excel

Public procedure LoadFromFile(const FileName: string; SkipAllChecks: boolean = false; Encoding: TEncoding = nil; Separator: string = #9);

load entire table from file (columns separated by TABs)

Public function FindIniRow(const IniKey: string): longint;

find row index of the Key

Public function SaveToIniFile(const IniFileName: string; Encoding: TEncoding = nil): string;

store 2 columns to ini file if defined and/or return inifile text content (Key=Value)

Public procedure LoadFromIniFile(const IniFileName: string; const IniFileContent: string = ''; Encoding: TEncoding = nil);

load 2 columns from ini file or from inifile text content (Key=Value), increase row count if needed

Public procedure LoadValuesFromIniFile(const IniFileName: string; const IniFileContent: string = ''; Encoding: TEncoding = nil);

load ValueColumn from ini file (Key=Value), do not change KeyColumn and row count

Public function IsIniGroupRow(ARow: longint): boolean;

return whether row is defined as Group row for INI grid

Public procedure SetColumnAutoFit(ColIdx: longint);

set column width according data width

Public procedure SetColumnsAutoFit;

set all columns width according data width

Public function GetColumnDataWidth(ColIdx: longint; MaxRowsToTest: longint = 10000): integer; virtual;

get maximal length or Field datawidth for the column

Public procedure DoEllipsisClick;

simulate click to ellipsis button

Public procedure FinishEditing;

hide editor and finish editing

Public procedure ResetChangeLog;

reset list of changed Rows and Cells

Public function ActiveCellText: string;

return content of active cell

Public function IsRowEmpty(ARow: longint; SkipFixedCol: boolean = true; ColumnGroup: integer = 0): boolean;

return true if all cells in row is empty

Public procedure SelectFirstCell(minCol: longint = 0; minRow: longint = 0);

move cursor to first selectable cell

Public procedure MoveRowEx(FromIndex, ToIndex: longint);

move row to new position

Public procedure InsertRowEx(RowIndex: longint; NumberOfRows: integer = 1; Activate: boolean = true);

insert new empty row to define index position

Public procedure DeleteRowEx(RowIndex: longint; NumberOfRows: integer = 1);

delete whole row

Public procedure MoveColumnEx(FromIndex, ToIndex: longint);

move column to new position

Public procedure InsertColumnEx(ColIndex: longint; NumberOfCols: integer = 1; Activate: boolean = true);

insert new empty column to define index position

Public procedure DeleteColumnEx(ColIndex: longint; NumberOfCols: integer = 1);

delete whole column

Public procedure SortData(ColIndex: integer; Desc: boolean = false; ResetSelection: boolean = false);

sort data/rows according selected column

Properties

Public property ScaleRatio: double read FScaleRatio;

define actual scale ratio relative to original designed size

Public property MouseDownCoord: TGridCoord read MDownCoord;

returns grid coord of last Mouse down (click or dblclick)

Public property MouseDownCellPoint: TPoint read MDownCellPoint;

returns point coord of the last Mouse down in the selected cell (reset to (0,0) after cell selection)

Public property StringCells[ACol,ARow:longint]: string read GetStringCells write SetStringCells;

read and set cells as string value

Public property NumCells[ACol,ARow:longint]: double read GetNumCells write SetNumCells;

read and set cells as double value

Public property IntCells[ACol,ARow:longint]: integer read GetIntCells write SetIntCells;

read and set cells as integer value

Public property BoolCells[ACol,ARow:longint]: boolean read GetBoolCells write SetBoolCells;

read and set cells as boolean value

Public property DateTimeCells[ACol,ARow:longint]: TDateTime read GetDateTimeCells write SetDateTimeCells;

read and set cells as boolean value

Public property SelectedRange: TGridRect read GetSelectedRange write SetSelectedRange;

return or set selection range coordinates

Public property IniValues[constIniKey:string]: string read GetIniValue write SetIniValue;

load or set Value for the Key

Public property ChangedRows: TStrings read FChangedRows;

store list of Row index which was modified

Public property ChangedCells: TStrings read FChangedCells;

store list of cells coordinates which was modified; format: ColIdx;RowIdx

Public property RichTextTopMargin: integer read FRichTextTopMargin write SetRichTextTopMargin;

top margin of RitchText in the cell

Public property TextApostrophe: char read FTextApostrophe write FTextApostrophe;

apostrophe used on beginning and end of the string for copy, load, save

Published property CustomGlyphs: TrCustomGlyphs read FCustomGlyphs write SetCustomGlyphs;

define link to rCustomGlyphs component which can define all glyphs

Published property OptionsEx: TOptionsEx read FOptionsEx write SetOptionsEx default[];

list of new options

Published property ColCount: longint read GetColCount write SetColCount default 5;

define number of columns, columns collection is updated automatically

Published property Columns: TrStringGridEdColumns read FColumns write FColumns;

columns collection, for detail see TrStringGridEdColumns

Published property IniKeyColumn: integer read FIniKeyColumn write FIniKeyColumn default 0;

define index of Key column for INI function

Published property IniValueColumn: integer read FIniValueColumn write FIniValueColumn default 1;

define index of Value column for INI function

Published property InnerMargin: integer read FInnerMargin write SetInnerMargin default 0;

define inner space between cell border and text in cell

Published property TitleRowHeight: integer read FTitleRowHeight write SetTitleRowHeight default 0;

Defines number of lines in title row

Published property AutoRowHeight: boolean read FAutoRowHeight write SetAutoRowHeight default false;

define whether row of column is set automatically, can be used with textwrap property of some column

Published property AutoRowMaxHeight: integer read FAutoRowMaxHeight write FAutoRowMaxHeight default 0;

define maximal row height during automatic setting (used if AutoRowHeight is set)

Published property AutoAddNewRow: boolean read FAutoAddNewRow write SetAutoAddNewRow default false;

define whether new row is automatically added if last row is edited

Published property ChangedCellsBkColor: TColor read FChangedCellsBkColor write SetChangedCellsBkColor default clInfoBk;

define background color of changed cells (used if dgColorChangedCells is set to true)

Published property SelectedCellBkColor: TColor read FSelectedCellBkColor write SetSelectedCellBkColor default clNone;

define background color of active cell with focus, default highlight is used if set to clNone

Published property InRangeCellsBkColor: TColor read FInRangeCellsBkColor write SetInRangeCellsBkColor default clNone;

define background color of cell in the selected range, default highlight is used if set to clNone

Published property CustomEditorCreate: TCustomEditorCreate read FCustomEditorCreate write FCustomEditorCreate;

event type for creating of CustomEditor

Published property CustomEditorEvent: TCustomEditorEvent read FCustomEditorEvent write FCustomEditorEvent;

event type for CustomEditor action

Published property OnDrawCellBackground: TDrawCellEvent read FOnDrawCellBackground write FOnDrawCellBackground;

event is called to draw cell background directly

Published property OnGetHintText: TGetHintText read FGetHintText write FGetHintText;

event for user defined setting of hint string

Published property OnCellClick: TFixedCellClickEvent read FOnCellClick write FOnCellClick;

event for user defined action after user click to any non fixed cell

Published property OnEllipsisClicked: TrStringGridEdCellEvent read FOnEllipsisClicked write FOnEllipsisClicked;

event for user defined action after click to ellipsis button

Published property OnPicklistDropdown: TrStringGridEdDropdownEvent read FOnPicklistDropdown write FOnPicklistDropdown;

event for user defined setting of values after click on drop down button

Published property OnEditorEvent: TrStringGridEdEditorEvent read FOnEditorEvent write FOnEditorEvent;

universal event called in different events of inplace editor

Published property OnGetCellParams: TGetCellParamsEvent read FOnGetCellParams write FOnGetCellParams;

event for user defined setting of individual cell params - font, color

Published property OnGetCellParamsEx: TGetCellParamsEventEx read FOnGetCellParamsEx write FOnGetCellParamsEx;

event for user defined setting of individual cell extended params - font, color, image

Published property OnGetDataType: TGetDataTypeEvent read FOnGetDataType write FOnGetDataType;

event for user defined setting of datatype for individual cell

Published property OnGetNumFormat: TGetNumFormat read FOnGetNumFormat write FOnGetNumFormat;

event for user defined setting of numformat for individual cell

Published property OnGetEditStyle: TGetEditStyleEvent read FOnGetEditStyle write FOnGetEditStyle;

event for user defined setting of editstyle for individual cell

Published property OnCanEdit: TCanEditEvent read FOnCanEdit write FOnCanEdit;

event for user defined setting whether individual cell can be edited

Published property OnFinishCellEditing: TrStringGridEdCellEvent read FOnFinishCellEditing write FOnFinishCellEditing;

event for user defined action after editing of cell is finished

Published property OnEditorKeyPress: TKeyPressEvent read FOnEditorKeyPress write FOnEditorKeyPress;

event for user defined action after press of key in editor

Published property OnColumnRestoreDefault: TOnColumnRestoreDefault read FOnColumnRestoreDefault write FOnColumnRestoreDefault;

event for user defined action for setting of default values

Published property OnGetEllipsisButtonFormat: TGetEllipsisButtonFormat read FOnGetEllipsisButtonFormat write FOnGetEllipsisButtonFormat;

event is called to define format of Ellipsis button in the cell

Published property OnProgress: TOnProgress read FOnProgress write FOnProgress;

event is called during sorting of data

Published property OnGeneralEvent: TGeneralEvent read FOnGeneralEvent write FOnGeneralEvent;

event is called in many events to add posibility of any custom code and to skip rest of the standard event


Generated by PasDoc 0.15.0.