📄 dbgrideh.~pas
字号:
public
procedure Assign(Source: TPersistent); override;
property AssignedValues: TColumnTitleDefValuesEhValues read FAssignedValues;
published
constructor Create(ColumnDefValues: TColumnDefValuesEh);
property Alignment: TAlignment read GetAlignment write SetAlignment stored IsAlignmentStored;
property Color: TColor read GetColor write SetColor stored IsColorStored;
property EndEllipsis: Boolean read FEndEllipsis write SetEndEllipsis default False;
property Orientation: TTextOrientationEh read FOrientation write SetOrientation default tohHorizontal;
property TitleButton: Boolean read FTitleButton write FTitleButton default False;
property ToolTips: Boolean read FToolTips write FToolTips default False;
end;
{ TColumnFooterDefValuesEh }
TColumnFooterDefValuesEh = class(TPersistent)
private
FToolTips: Boolean;
public
procedure Assign(Source: TPersistent); override;
published
property ToolTips: Boolean read FToolTips write FToolTips default False;
end;
{ TColumnDefValuesEh }
TColumnDefValuesEh = class(TPersistent)
private
FAlwaysShowEditButton: Boolean;
FAutoDropDown: Boolean;
FDblClickNextVal: Boolean;
FDropDownShowTitles: Boolean;
FDropDownSizing: Boolean;
FEndEllipsis: Boolean;
FGrid: TCustomDBGridEh;
FTitle: TColumnTitleDefValuesEh;
FFooter: TColumnFooterDefValuesEh;
FToolTips: Boolean;
procedure SetAlwaysShowEditButton(const Value: Boolean);
procedure SetEndEllipsis(const Value: Boolean);
procedure SetTitle(const Value: TColumnTitleDefValuesEh);
procedure SetFooter(const Value: TColumnFooterDefValuesEh);
public
procedure Assign(Source: TPersistent); override;
public
constructor Create(Grid: TCustomDBGridEh);
destructor Destroy; override;
property AlwaysShowEditButton: Boolean read FAlwaysShowEditButton write SetAlwaysShowEditButton default False;
property AutoDropDown: Boolean read FAutoDropDown write FAutoDropDown default False;
property DblClickNextVal: Boolean read FDblClickNextVal write FDblClickNextVal default False;
property DropDownShowTitles: Boolean read FDropDownShowTitles write FDropDownShowTitles default False;
property DropDownSizing: Boolean read FDropDownSizing write FDropDownSizing default False;
property EndEllipsis: Boolean read FEndEllipsis write SetEndEllipsis default False;
property Title: TColumnTitleDefValuesEh read FTitle write SetTitle;
property Footer: TColumnFooterDefValuesEh read FFooter write SetFooter;
property ToolTips: Boolean read FToolTips write FToolTips default False;
end;
TDBGridEhColumnDefValuesEh = class(TColumnDefValuesEh)
published
property AlwaysShowEditButton;
property AutoDropDown;
property DblClickNextVal;
property DropDownShowTitles;
property DropDownSizing;
property EndEllipsis;
property Footer;
property Title;
property ToolTips;
end;
{ TSTColumnFilterEh }
TSTFilterOperatorEh = (
foNon, foEqual, foNotEqual,
foGreaterThan, foLessThan, foGreaterOrEqual, foLessOrEqual,
foLike, foNotLike,
foIn, foNotIn,
foNull, foNotNull,
foAND, foOR,
foValue);
TSTOperandTypeEh = (botNon, botString, botNumber, botDateTime, botBoolean);
TSTFilterExpressionEh = record
ExpressionType: TSTOperandTypeEh;
Operator1: TSTFilterOperatorEh;
Operand1: Variant;
Relation: TSTFilterOperatorEh; // foAND, foOR, foNon
Operator2: TSTFilterOperatorEh;
Operand2: Variant;
end;
TSTColumnFilterEh = class(TPersistent)
private
FColumn: TColumnEh;
FDataField: String;
FKeyCommaText: String;
FKeyField: String;
FKeys: TStrings;
FKeyValues: Variant;
FList: TStrings;
FListField: String;
FListLink: TFieldDataLink;
FVisible: Boolean;
function GetExpression: TSTFilterExpressionEh;
function GetGrid: TCustomDBGridEh;
function GetListSource: TDataSource;
function ParseExpression(Exp: String): String;
procedure ListLinkActiveChange(Sender: TObject);
procedure SetExpression(const Value: TSTFilterExpressionEh);
procedure SetExpressionStr(const Value: String);
procedure SetListSource(const Value: TDataSource);
procedure SetVisible(const Value: Boolean);
protected
FExpression: TSTFilterExpressionEh;
FExpressionStr: String;
function GetExpressionAsString: String; virtual;
function DropDownButtonVisible: Boolean; virtual;
procedure InternalSetExpressionStr(const Value: String);
public
constructor Create(AColumn: TColumnEh);
destructor Destroy; override;
function GetFilterFieldName: String; virtual;
function GetOperand1: Variant; virtual;
function GetOperand2: Variant; virtual;
procedure Assign(Source: TPersistent); override;
procedure Clear;
procedure SetKeyListValues(AText: String; KeyVals: Variant);
procedure SetKeysFromListValues(ss: TStrings);
property Column: TColumnEh read FColumn;
property Expression: TSTFilterExpressionEh read GetExpression write SetExpression;
property ExpressionStr: String read FExpressionStr write SetExpressionStr;
property Grid: TCustomDBGridEh read GetGrid;
property KeyCommaText: String read FKeyCommaText write FKeyCommaText;
published
property DataField: String read FDataField write FDataField;
property KeyField: String read FKeyField write FKeyField;
property ListField: String read FListField write FListField;
property ListSource: TDataSource read GetListSource write SetListSource;
property Visible: Boolean read FVisible write SetVisible default True;
end;
{ TColumnEh }
TColCellParamsEh = class
protected
FAlignment: TAlignment;
FBackground: TColor;
FCheckboxState: TCheckBoxState;
FCol: Longint;
FFont: TFont;
FImageIndex: Integer;
FReadOnly: Boolean;
FRow: Longint;
FState: TGridDrawState;
FText: String;
public
property Alignment: TAlignment read FAlignment write FAlignment;
property Background: TColor read FBackground write FBackground;
property CheckboxState: TCheckBoxState read FCheckboxState write FCheckboxState;
property Col: Longint read FCol write FCol;
property Font: TFont read FFont write FFont;
property ImageIndex: Integer read FImageIndex write FImageIndex;
property ReadOnly: Boolean read FReadOnly write FReadOnly;
property Row: Longint read FRow write FRow;
property State: TGridDrawState read FState write FState;
property Text: String read FText write FText;
end;
TGetColCellParamsEventEh = procedure(Sender: TObject; EditMode: Boolean;
Params: TColCellParamsEh) of object;
TColCellUpdateDataEventEh = procedure(Sender: TObject; var Text: String;
var Value: Variant; var UseText: Boolean; var Handled: Boolean) of object;
TColumnEh = class(TCollectionItem, ILookupGridOwner {$IFNDEF CIL}, IUnknown {$ENDIF})
private
FAlignment: TAlignment;
FAssignedValues: TColumnEhValues;
FButtonStyle: TColumnButtonStyleEh;
FCheckboxes: Boolean;
FColor: TColor;
FDblClickNextVal: Boolean;
FDisplayFormat: string;
FDropDownBox: TColumnDropDownBoxEh;
FDropDownRows: Cardinal;
FDropDownShowTitles: Boolean;
FDropDownSizing: Boolean;
FDropDownSpecRow: TSpecRowEh;
FEditButtons: TEditButtonsEh;
FEditMask: string;
FField: TField;
FFieldName: string;
FFont: TFont;
FFooter: TColumnFooterEh;
FFooters: TColumnFootersEh;
FImageList: TCustomImageList;
FImageChangeLink: TChangeLink;
{$IFDEF EH_LIB_VCL}
FImeMode: TImeMode;
FImeName: TImeName;
{$ENDIF}
FIncrement: Extended;
FKeyList: TStrings;
FMaxWidth: Integer;
FMinWidth: Integer;
FMRUList: TMRUListEh;
FNotInKeyListIndex: Integer;
FNotInWidthRange: Boolean;
FOnButtonClick: TButtonClickEventEh;
FOnButtonDown: TButtonDownEventEh;
FOnGetCellParams: TGetColCellParamsEventEh;
// FOnGetItemImageIndex: TListGetImageIndexEventEh;
FOnNotInList: TNotInListEventEh;
FPickList: TStrings;
FPopupMenu: TPopupMenu;
FReadonly: Boolean;
FStored: Boolean;
FShowImageAndText: Boolean;
FTag: Longint;
FTitle: TColumnTitleEh;
FToolTips: Boolean;
FUpdateData: TColCellUpdateDataEventEh;
FVisible: Boolean;
FWidth: Integer;
FSTFilter: TSTColumnFilterEh;
function DefaultCheckboxes: Boolean;
function GetAlignment: TAlignment;
function GetAlwaysShowEditButton: Boolean;
function GetAutoDropDown: Boolean;
function GetCheckboxes: Boolean;
function GetCheckboxState: TCheckBoxState;
function GetColor: TColor;
function GetDataList: TCustomDBGridEh;
function GetDblClickNextVal: Boolean;
function GetDropDownShowTitles: Boolean;
function GetDropDownSizing: Boolean;
function GetEndEllipsis: Boolean;
function GetField: TField;
function GetFont: TFont;
{$IFDEF EH_LIB_VCL}
function GetImeMode: TImeMode;
function GetImeName: TImeName;
{$ENDIF}
function GetKeykList: TStrings;
function GetOnDropDownBoxCheckButton: TCheckTitleEhBtnEvent;
function GetOnDropDownBoxDrawColumnCell: TDrawColumnEhCellEvent;
function GetOnDropDownBoxGetCellParams: TGetCellEhParamsEvent;
function GetOnDropDownBoxSortMarkingChanged: TNotifyEvent;
function GetOnDropDownBoxTitleBtnClick: TTitleEhClickEvent;
function GetPickList: TStrings;
function GetReadOnly: Boolean;
function GetToolTips: Boolean;
function GetWidth: Integer;
function IsAlignmentStored: Boolean;
function IsAlwaysShowEditButtonStored: Boolean;
function IsAutoDropDownStored: Boolean;
function IsCheckboxesStored: Boolean;
function IsColorStored: Boolean;
function IsDblClickNextValStored: Boolean;
function IsDropDownShowTitlesStored: Boolean;
function IsDropDownSizingStored: Boolean;
function IsEndEllipsisStored: Boolean;
function IsFontStored: Boolean;
function IsImeModeStored: Boolean;
function IsImeNameStored: Boolean;
function IsIncrementStored: Boolean;
function IsReadOnlyStored: Boolean;
function IsToolTipsStored: Boolean;
function IsWidthStored: Boolean;
procedure EditButtonChanged(Sender: TObject);
procedure ImageListChange(Sender: TObject);
procedure FontChanged(Sender: TObject);
procedure SetButtonStyle(Value: TColumnButtonStyleEh);
procedure SetCheckboxes(const Value: Boolean);
procedure SetCheckboxState(const Value: TCheckBoxState);
procedure SetColor(Value: TColor);
procedure SetDblClickNextVal(const Value: Boolean);
procedure SetDisplayFormat(const Value: string);
procedure SetDropDownBox(const Value: TColumnDropDownBoxEh);
procedure SetDropDownShowTitles(const Value: Boolean);
procedure SetDropDownSizing(const Value: Boolean);
procedure SetDropDownSpecRow(const Value: TSpecRowEh);
procedure SetEditButtons(const Value: TEditButtonsEh);
procedure SetEditMask(const Value: string);
procedure SetFieldName(const Value: String);
procedure SetFont(Value: TFont);
procedure SetFooter(const Value: TColumnFooterEh);
procedure SetFooters(const Value: TColumnFootersEh);
procedure SetImageList(const Value: TCustomImageList);
procedure SetKeykList(const Value: TStrings);
procedure SetMaxWidth(const Value: Integer);
procedure SetMinWidth(const Value: Integer);
procedure SetMRUList(const Value: TMRUListEh);
procedure SetNotInKeyListIndex(const Value: Integer);
procedure SetOnDropDownBoxCheckButton(const Value: TCheckTitleEhBtnEvent);
procedure SetOnDropDownBoxDrawColumnCell(const Value: TDrawColumnEhCellEvent);
procedure SetOnDropDownBoxGetCellParams(const Value: TGetCellEhParamsEvent);
procedure SetOnDropDownBoxSortMarkingChanged(const Value: TNotifyEvent);
procedure SetOnDropDownBoxTitleBtnClick(const Value: TTitleEhClickEvent);
procedure SetOnGetCellParams(const Value: TGetColCellParamsEventEh);
procedure SetPickList(Value: TStrings);
procedure SetPopupMenu(Value: TPopupMenu);
procedure SetTitle(Value: TColumnTitleEh);
procedure SetToolTips(const Value: Boolean);
procedure SetVisible(const Value: Boolean);
procedure SetSTFilter(const Value: TSTColumnFilterEh);
function GetShowImageAndText: Boolean;
procedure SetShowImageAndText(const Value: Boolean);
protected
FAlwaysShowEditButton: Boolean;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -