?? dbgrideh.pas
字號:
procedure SetLocal(const Value: Boolean);
procedure SetVisible(const Value: Boolean);
public
constructor Create(AGrid: TCustomDBGridEh);
procedure Assign(Source: TPersistent); override;
procedure BeginUpdate;
procedure EndUpdate;
property UpdateCount: Integer read FUpateCount;
published
property Local: Boolean read FLocal write SetLocal default False;
property Visible: Boolean read FVisible write SetVisible default False;
end;
{ TCustomDBGridEh }
THorzCellTypeEh = (hctIndicatorEh, hctDataEh);
TVertCellTypeEh = (vctTitleEh, vctSubTitleEh, vctDataEh, vctAboveFooterEh, vctFooterEh);
TCellTypeEh = record
HorzType: THorzCellTypeEh;
VertType: TVertCellTypeEh;
end;
TDBGridEhOption = (dghFixed3D, dghFrozen3D, dghFooter3D, dghData3D, dghResizeWholeRightPart,
dghHighlightFocus, dghClearSelection, dghFitRowHeightToText, dghAutoSortMarking,
dghMultiSortMarking, dghEnterAsTab, dghTraceColSizing, dghIncSearch,
dghPreferIncSearch, dghRowHighlight, dghDblClickOptimizeColWidth, dghDialogFind,
dghRecordMoving);
TDBGridEhOptions = set of TDBGridEhOption;
TDBGridEhState = (dgsNormal, dgsRowSelecting, dgsColSelecting, dgsRectSelecting,
dgsPosTracing, dgsTitleDown, dgsColSizing, dgsRowMoving);
TDBGridEhAllowedOperation = (alopInsertEh, alopUpdateEh, alopDeleteEh, alopAppendEh);
TDBGridEhAllowedOperations = set of TDBGridEhAllowedOperation;
TDBGridEhEditAction = (geaCutEh, geaCopyEh, geaPasteEh, geaDeleteEh, geaSelectAllEh);
TDBGridEhEditActions = set of TDBGridEhEditAction;
// TInpsDirectionEh = (inpsFromFirstEh, inpsToNextEh, inpsToPriorEh);
{ The DBGridEh's DrawDataCell virtual method and OnDrawDataCell event are only
called when the grid's Columns.State is csDefault. This is for compatibility
with existing code. These routines don't provide sufficient information to
determine which column is being drawn, so the column attributes aren't
easily accessible in these routines. Column attributes also introduce the
possibility that a column's field may be nil, which would break existing
DrawDataCell code. DrawDataCell, OnDrawDataCell, and DefaultDrawDataCell
are obsolete, retained for compatibility purposes. }
(* TDrawDataCellEvent = procedure (Sender: TObject; const Rect: TRect; Field: TField;
State: TGridDrawState) of object; *)
{ The DBGridEh's DrawColumnCell virtual method and OnDrawColumnCell event are
always called, when the grid has defined column attributes as well as when
it is in default mode. These new routines provide the additional
information needed to access the column attributes for the cell being
drawn, and must support nil fields. }
TDBGridEhClickEvent = procedure(Column: TColumnEh) of object;
TDrawFooterCellEvent = procedure(Sender: TObject; DataCol, Row: Longint;
Column: TColumnEh; Rect: TRect; State: TGridDrawState) of object;
TGetFooterParamsEvent = procedure(Sender: TObject; DataCol, Row: Longint;
Column: TColumnEh; AFont: TFont; var Background: TColor;
var Alignment: TAlignment; State: TGridDrawState; var Text: String) of object;
TGetBtnEhParamsEvent = procedure(Sender: TObject; Column: TColumnEh;
AFont: TFont; var Background: TColor; var SortMarker: TSortMarkerEh;
IsDown: Boolean) of object;
(*
{ Internal grid types }
TGridAxisDrawInfoEh = record
EffectiveLineWidth: Integer;
FirstGridCell: Integer;
FixedBoundary: Integer;
FixedCellCount: Integer;
FooterExtent: Integer;
FrozenExtent: Integer;
FullVisBoundary: Integer;
GetExtent: TGetExtentsFunc;
GridBoundary: Integer;
GridCellCount: Integer;
GridExtent: Integer;
LastFullVisibleCell: Longint;
end;
TGridDrawInfoEh = record
Horz, Vert: TGridAxisDrawInfoEh;
end;
*)
TCustomDBGridEh = class(TCustomGridEh, IInplaceEditHolderEh {$IFNDEF CIL}, IUnknown {$ENDIF})
private
FAllowedOperations: TDBGridEhAllowedOperations;
FAllowedSelections: TDBGridEhAllowedSelections;
FAutoDrag, FSelectedCellPressed: Boolean;
FBookmarks: TBookmarkListEh;
FCanvasHandleAllocated: Boolean;
FCenter: TDBGridEhCenter;
FColumnDefValues: TColumnDefValuesEh;
FColumns: TDBGridColumnsEh;
FCompleteKeyPress: String;
FDataLink: TGridDataLinkEh;
FDefaultDrawing: Boolean;
FEditActions: TDBGridEhEditActions;
FEditKeyValue: Variant; // For lookup fields and KeyList based column
FEditText: string;
//gridseh FFlat: Boolean;
FFooterColor: TColor;
FFooterFont: TFont;
FHintFont: TFont;
FHorzScrollBar: TDBGridEhScrollBar;
FInColExit: Boolean;
FIndicatorTitle: TDBGridEhIndicatorTitle;
FInterlinear: Integer;
FLayoutFromDataset: Boolean;
FLayoutLock: Byte;
FOnBuildIndicatorTitleMenu: TDBGridEhBuildIndicatorTitleMenu;
FOnCellClick: TDBGridEhClickEvent;
FOnColEnter: TNotifyEvent;
FOnColExit: TNotifyEvent;
FOnColumnMoved: TMovedEvent;
FOnColWidthsChanged: TNotifyEvent;
FOnDrawColumnCell: TDrawColumnEhCellEvent;
FOnDrawDataCell: TDrawDataCellEvent;
FOnEditButtonClick: TNotifyEvent;
FOnGetCellParams: TGetCellEhParamsEvent;
FOnGetFooterParams: TGetFooterParamsEvent;
FOnIndicatorTitleMouseDown: TGridEhCellMouseEvent;
FOnSelectionChanged: TNotifyEvent;
FOnSortMarkingChanged: TNotifyEvent;
FOnSumListAfterRecalcAll: TNotifyEvent;
FOnSumListRecalcAll: TNotifyEvent;
FOnTitleClick: TDBGridEhClickEvent;
FOptions: TDBGridOptions;
FOptionsEh: TDBGridEhOptions;
{$IFDEF EH_LIB_VCL}
FOriginalImeMode: TImeMode;
FOriginalImeName: TImeName;
{$ENDIF}
FReadOnly: Boolean;
FSelecting: Boolean;
FSelection: TDBGridEhSelection;
FSelectionAnchor: TBookmarkStr;
FSelfChangingFooterFont: Boolean;
FSelfChangingTitleFont: Boolean;
FSelRow: Integer;
FSizingIndex: Longint;
FSizingPos, FSizingOfs: Integer;
FSortLocal: Boolean;
FSortMarking: Boolean;
FStyle: TDBGridEhStyle;
FSumListRecalcing: Boolean;
FThumbTracked: Boolean;
FTitleFont: TFont;
FTitleImages: TCustomImageList;
FTitleImageChangeLink: TChangeLink;
FTitleOffset: Byte;
FIndicatorOffset: Byte;
FTopDataOffset: Byte;
FTopLeftVisible: Boolean;
FUpdateLock: Byte;
FUserChange: Boolean;
FVertScrollBar: TDBGridEhScrollBar;
FIntMemTable: IMemTableEh;
FOldActiveRecord: Integer;
FLockAutoShowCurCell: Boolean;
FFetchingRecords: Boolean;
FTryUseMemTableInt: Boolean;
FSTFilter: TSTDBGridEhFilter;
FFilterCol: Integer;
FFilterEditMode: Boolean;
FFilterEdit: TCustomDBEditEh;
FOnApplyFilter: TNotifyEvent;
FDownMouseMessageTime: LongInt;
FBufferedPaint: Boolean;
FSizeChanged: Boolean;
FEvenRowColorStored: Boolean;
FOddRowColorStored: Boolean;
FEvenRowColor: TColor;
FOddRowColor: TColor;
FContraColCount: Integer;
procedure CheckIMemTable;
procedure MTUpdateRowCount;
procedure MTScroll(Distance: Integer);
function IsCurrentRow(DataRowNum: Integer): Boolean;
procedure FetchRecordsInView;
procedure InstantReadRecordEnter(DataRowNum: Integer);
procedure InstantReadRecordLeave;
function InstantReadRecordCount: Integer;
procedure MTUpdateVertScrollBar;
procedure MTUpdateTopRow;
procedure MTWMVScroll(var Message: TWMVScroll);
function GetCol: Longint;
function GetContraColCount: Longint;
function GetDataSource: TDataSource;
function GetEvenRowColor: TColor;
function GetFieldColumns(const FieldName: String): TColumnEh;
function GetFieldCount: Integer;
function GetFields(FieldIndex: Integer): TField;
function GetOddRowColor: TColor;
// function GetRowHeights(Index: Longint): Integer;
function GetSelectedField: TField;
function GetSelectedIndex: Integer;
function GetTopDataOffset: Byte;
// function IsActiveControl: Boolean;
function IsEvenRowColorStored: Boolean;
function IsOddRowColorStored: Boolean;
// procedure CalcDrawInfoXYEh(var DrawInfo: TGridDrawInfoEh; UseWidth, UseHeight: Integer);
procedure ChangeGridOrientation(RightToLeftOrientation: Boolean);
procedure ClearSelection;
{$IFDEF EH_LIB_VCL}
procedure CMCancelMode(var Message: TCMCancelMode); message CM_CancelMode;
procedure CMDeferLayout(var Message: TMessage); message cm_DeferLayout;
procedure CMDesignHitTest(var Msg: TCMDesignHitTest); message CM_DESIGNHITTEST;
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure CMHintShow(var Message: TCMHintShow); message CM_HINTSHOW;
procedure CMHintsShowPause(var Message: TCMHintShowPause); message CM_HINTSHOWPAUSE;
procedure CMMouseWheel(var Message: TCMMouseWheel); message CM_MOUSEWHEEL;
procedure CMParentColorChanged(var Message: TMessage); message CM_PARENTCOLORCHANGED;
procedure CMParentFontChanged(var Message: TCMParentFontChanged); message CM_PARENTFONTCHANGED;
procedure CMSysColorChange(var Message: TMessage); message CM_SYSCOLORCHANGE;
{$ENDIF}
procedure DoSelection(Select: Boolean; Direction: Integer; MaxDirection, RowOnly: Boolean);
procedure DrawEdgeEh(ACanvas: TCanvas; qrc: TRect; IsDown, IsSelected: Boolean; NeedLeft, NeedRight: Boolean);
procedure EditingChanged;
procedure FooterFontChanged(Sender: TObject);
procedure InternalLayout;
procedure MoveCol(RawCol, Direction: Integer; Select: Boolean);
procedure ReadColumns(Reader: TReader);
procedure RecordChanged(Field: TField);
procedure SetAllowedSelections(const Value: TDBGridEhAllowedSelections);
procedure SetCenter(const Value: TDBGridEhCenter);
procedure SetCol(Value: Longint);
procedure SetColumnDefValues(const Value: TColumnDefValuesEh);
procedure SetColumns(Value: TDBGridColumnsEh);
procedure SetContraColCount(const Value: Longint);
procedure SetDataSource(Value: TDataSource);
procedure SetDrawMemoText(const Value: Boolean);
procedure SetEvenRowColor(const Value: TColor);
procedure SetFilterEditMode(const Value: Boolean);
//gridseh procedure SetFlat(const Value: Boolean);
procedure SetFooterColor(Value: TColor);
procedure SetFooterFont(Value: TFont);
procedure SetHorzScrollBar(const Value: TDBGridEhScrollBar);
procedure SetIme;
procedure SetOddRowColor(const Value: TColor);
procedure SetOptions(Value: TDBGridOptions);
procedure SetOptionsEh(const Value: TDBGridEhOptions);
procedure SetReadOnly(const Value: Boolean);
procedure SetSelectedField(Value: TField);
procedure SetSelectedIndex(Value: Integer);
procedure SetSTFilter(const Value: TSTDBGridEhFilter);
procedure SetStyle(const Value: TDBGridEhStyle);
procedure SetSumList(const Value: TDBGridEhSumList);
procedure SetTitleFont(Value: TFont);
procedure SetTitleImages(const Value: TCustomImageList);
procedure SetVertScrollBar(const Value: TDBGridEhScrollBar);
procedure TitleFontChanged(Sender: TObject);
procedure TitleImageListChange(Sender: TObject);
procedure UpdateIme;
{$IFDEF EH_LIB_VCL}
procedure WMCancelMode(var Message: TWMCancelMode); message WM_CANCELMODE;
procedure WMChar(var Message: TWMChar); message WM_CHAR;
procedure WMCommand(var Message: TWMCommand); message WM_COMMAND;
procedure WMEraseBkgnd(var Message: TWmEraseBkgnd); message WM_ERASEBKGND; //tmp
procedure WMGetDlgCode(var Msg: TWMGetDlgCode); message WM_GETDLGCODE;
procedure WMHScroll(var Message: TWMHScroll); message WM_HSCROLL;
procedure WMIMEStartComp(var Message: TMessage); message WM_IME_STARTCOMPOSITION;
procedure WMKillFocus(var Message: TWMKillFocus); message WM_KillFocus;
procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN;
procedure WMNCCalcSize(var Message: TWMNCCalcSize); message WM_NCCALCSIZE;
procedure WMNCPaint(var Message: TWMNCPaint); message WM_NCPAINT;
procedure WMPaint(var Message: TWMPaint); message WM_PAINT;
procedure WMRButtonDown(var Message: TWMRButtonDown); message WM_RBUTTONDOWN;
procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR;
procedure WMSetFocus(var Message: TWMSetFocus); message WM_SetFOCUS;
procedure WMSize(var Message: TWMSize); message WM_SIZE;
procedure WMTimer(var Message: TWMTimer); message WM_TIMER;
procedure WMVScroll(var Message: TWMVScroll); message WM_VSCROLL;
{$ENDIF}
procedure WriteColumns(Writer: TWriter);
procedure PaintInplaceButton(Column: TColumnEh; Canvas: TCanvas;
ButtonStyle: TEditButtonStyleEh; Rect, ClipRect: TRect;
DownButton: Integer; Active, Flat, Enabled: Boolean;
ParentColor: TColor; Bitmap: TBitmap);
protected
{ IInplaceEditHolderEh }
function InplaceEditCanModify(Control: TWinControl): Boolean;
procedure GetMouseDownInfo(var Pos: TPoint; var Time: LongInt);
procedure InplaceEditKeyDown(Control: TWinControl; var Key: Word; Shift: TShiftState);
procedure InplaceEditKeyPress(Control: TWinControl; var Key: Char);
procedure InplaceEditKeyUp(Control: TWinControl; var Key: Word; Shift: TShiftState);
procedure InplaceEditWndProc(Control: TWinControl; var Message: TMessage);
protected
// FSortMarkerImages: TImageList;
FAcquireFocus: Boolean;
FAllowWordWrap: Boolean; // True if RowHeight + 3 > TextHeight
FAntiSelection: Boolean;
FAutoFitColWidths: Boolean;
FBorderWidth: Integer;
FColCellParamsEh: TColCellParamsEh;
FDataTracking: Boolea
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -