📄 dbgrideh.pas
字号:
TColumnTitleDefValuesEhValues = set of TColumnTitleDefValuesEhValue;
TColumnTitleDefValuesEh = class(TPersistent)
private
FAlignment: TAlignment;
FAssignedValues: TColumnTitleDefValuesEhValues;
FColor: TColor;
FColumnDefValues: TColumnDefValuesEh;
FEndEllipsis: Boolean;
FOrientation: TTextOrientationEh;
FTitleButton: Boolean;
FToolTips: Boolean;
function DefaultAlignment: TAlignment;
function DefaultColor: TColor;
function GetAlignment: TAlignment;
function GetColor: TColor;
function IsAlignmentStored: Boolean;
function IsColorStored: Boolean;
procedure SetAlignment(const Value: TAlignment);
procedure SetColor(const Value: TColor);
procedure SetEndEllipsis(const Value: Boolean);
procedure SetOrientation(const Value: TTextOrientationEh);
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;
FLayout: TTextLayout;
FHighlightRequired: Boolean;
FGrid: TCustomDBGridEh;
FTitle: TColumnTitleDefValuesEh;
FFooter: TColumnFooterDefValuesEh;
FToolTips: Boolean;
procedure SetAlwaysShowEditButton(const Value: Boolean);
procedure SetEndEllipsis(const Value: Boolean);
procedure SetFooter(const Value: TColumnFooterDefValuesEh);
procedure SetHighlightRequired(Value: Boolean);
procedure SetLayout(Value: TTextLayout);
procedure SetTitle(const Value: TColumnTitleDefValuesEh);
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 Footer: TColumnFooterDefValuesEh read FFooter write SetFooter;
property HighlightRequired: Boolean read FHighlightRequired write SetHighlightRequired default False;
property Layout: TTextLayout read FLayout write SetLayout default tlTop;
property Title: TColumnTitleDefValuesEh read FTitle write SetTitle;
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 HighlightRequired;
property Layout;
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;
FDropDownListWidth: Integer;
FDropDownListRows: Integer;
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);
procedure CheckRecodeKeyList(var FExpression: TSTFilterExpressionEh); virtual;
public
constructor Create(AColumn: TColumnEh);
destructor Destroy; override;
function GetFieldValueList: IMemTableDataFieldValueListEh;
function GetFilterFieldName: String; virtual;
function GetOperand1: Variant; virtual;
function GetOperand2: Variant; virtual;
function CurrentKeyField: String;
function CurrentDataField: String;
function CurrentListDataSet: TDataSet;
function CurrentListField: String;
procedure Assign(Source: TPersistent); override;
procedure Clear;
procedure SetKeyListValues(AText: String; KeyVals: Variant);
procedure SetKeysFromListValues(ss: TStrings);
property DropDownListWidth: Integer read FDropDownListWidth write FDropDownListWidth default 0;
property DropDownListRows: Integer read FDropDownListRows write FDropDownListRows default 0;
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(TObject)
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;
FBiDiMode: TBiDiMode;
FButtonStyle: TColumnButtonStyleEh;
FCheckboxes: Boolean;
FCheckedDuplicates: array of 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;
FHideDuplicates: Boolean;
FHighlightRequired: Boolean;
FImageList: TCustomImageList;
FImageChangeLink: TChangeLink;
{$IFDEF EH_LIB_VCL}
FImeMode: TImeMode;
FImeName: TImeName;
{$ENDIF}
FIncrement: Extended;
FLayout: TTextLayout;
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;
FFieldValueList: IMemTableDataFieldValueListEh;
FOnCheckDrawRequiredState: TOnColumnCheckDrawRequiredStateEventEh;
function DefaultCheckboxes: Boolean;
function GetAlignment: TAlignment;
function GetAlwaysShowEditButton: Boolean;
function GetAutoDropDown: Boolean;
function GetBiDiMode: TBiDiMode;
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 GetHighlightRequired: Boolean;
function GetKeykList: TStrings;
function GetLayout: TTextLayout;
function GetOnDropDownBoxCheckButton: TCheckTitleEhBtnEvent;
function GetOnDropDownBoxDrawColumnCell: TDrawColumnEhCellEvent;
function GetOnDropDownBoxGetCellParams: TGetCellEhParamsEvent;
function GetOnDropDownBoxSortMarkingChanged: TNotifyEvent;
function GetOnDropDownBoxTitleBtnClick: TTitleEhClickEvent;
function GetPickList: TStrings;
function GetReadOnly: Boolean;
function GetShowImageAndText: Boolean;
function GetToolTips: Boolean;
function GetWidth: Integer;
function IsAlignmentStored: Boolean;
function IsAlwaysShowEditButtonStored: Boolean;
function IsAutoDropDownStored: Boolean;
function IsBiDiModeStored: Boolean;
function IsCheckboxesStored: Boolean;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -