📄 wwdbigrd.pas
字号:
const DrawInfo: TGridDrawInfo): TGridCoord;
}
function CalcMaxTopLeft(const Coord: TGridCoord;
const DrawInfo: TGridDrawInfo): TGridCoord;
procedure SetGroupFieldName(Value: string);
protected
FCacheColInfo: TList; //PwwCustomControlItem;
FTopRecord: integer;
FIndicatorOffset: Byte;
TempRichEdit: TwwDBRichEdit;
FUpdateFields: Boolean;
FAcquireFocus: Boolean;
SuppressShowEditor: boolean;
ShiftSelectMode: boolean;
ShiftSelectBookmark: TBookmark;
dummy1, dummy2: string;
TitleTextOffset: integer;
FieldMappedText: boolean;
URLLinkActive: boolean;
// RichEditBufferList: TStrings;
HintWindow: THintWindow;
OrigColWidths: PWordArray;
OrigColWidthsCount: integer;
DrawCellInfo: TwwCustomDrawGridCellInfo;
{$ifdef wwDelphi4Up}
SkipErase: boolean; { 1/26/99 - Prevent clearing of grid when hiding controls }
{$endif}
CurrentCustomEdit: TWinControl;
FDateTimePicker: TwwDBCustomDateTimePicker;
FFocused: boolean;
function UseAlternateBuffering: boolean; virtual;
function GetGridDataBottom(DrawInfo: TGridDrawInfo): integer; virtual;
procedure ResetTitleClick;
procedure UpdateLeftCol(ACol: integer);
procedure ShowEditor; virtual;
procedure CreateParams(var Params: TCreateParams); override;
procedure MoveCol(ACol: Integer);
procedure DoCreateHintWindow(
HintWindow: TwwGridHintWindow;
AField: TField; R: TRect;
var WordWrap: boolean;
var MaxWidth, MaxHeight: integer;
var DoDefault: boolean); virtual;
Function IsProportionalColumns: boolean; virtual;
// procedure InitIndicators;
procedure DoURLOpen(var URLLink: string; Field: TField; var UseDefault: boolean); virtual;
Function IsDropDownGridFocused: boolean;
Function IsDropDownGridShowing: boolean;
procedure FillWithAlternatingRowBitmap(TempRect: TRect); virtual;
procedure LayoutChanged; virtual;
procedure CalcRowHeight; dynamic;
function RecordCountIsValid: boolean;
// function CalcVariableRowCount: integer; virtual;
Function AllowCancelOnExit: boolean; dynamic;
function CanEditAcceptKey(Key: Char): Boolean; override;
function CanEditModify: Boolean; override;
function GetEditLimit: Integer; override;
procedure ColumnMoved(FromIndex, ToIndex: Longint); override;
procedure ColEnter; dynamic;
procedure ColExit; dynamic;
procedure Scroll(Distance: Integer); virtual;
procedure ColWidthsChanged; override;
function HighlightCell(DataCol, DataRow: Integer; const Value: string;
AState: TGridDrawState): Boolean; virtual;
procedure DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState); override;
function GetEditMask(ACol, ARow: Longint): string; override;
function GetEditText(ACol, ARow: Longint): string; override;
procedure SetEditText(ACol, ARow: Longint; const Value: string); override;
function GetColField(ACol: Integer): TField;
function GetFieldValue(ACol: Integer): string; dynamic; // obsolete
procedure DefineFieldMap; virtual;
procedure DrawDataCell(const Rect: TRect; Field: TField;
State: TGridDrawState); dynamic;
procedure ProportionalColWidths; virtual;
procedure SetColumnAttributes; virtual;
procedure KeyPress(var Key: Char); override;
procedure LinkActive(Value: Boolean); virtual;
procedure Loaded; override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure TimedScroll(Direction: TGridScrollDirection); override;
procedure CreateWnd; override;
function IsWWControl(ACol, ARow: integer): boolean; virtual;
procedure InvalidateTitle; virtual;
property DefaultDrawing: Boolean read FDefaultDrawing write FDefaultDrawing default True;
property DataSource: TDataSource read GetDataSource write SetDataSource; {W2W}
// property VDataLink: TwwGridDataLink read FVDataLink;
property ParentColor default False;
property ReadOnly: Boolean read FReadOnly write FReadOnly default False;
property TitleColor: TColor read FTitleColor write FTitleColor default clBtnFace;
// property DataLineColor: TColor read FDataLineColor write FDataLineColor default clSilver;
property FooterColor: TColor read FFooterColor write SetFooterColor default clBtnFace;
property FooterCellColor: TColor read FFooterCellColor write SetFooterCellColor default clBtnFace;
property FooterHeight: integer read FFooterHeight write SetFooterHeight default 0;
property TitleFont: TFont read FTitleFont write SetTitleFont;
property OnColEnter: TNotifyEvent read FOnColEnter write FOnColEnter;
property OnColExit: TNotifyEvent read FOnColExit write FOnColExit;
property OnDrawDataCell: TwwDrawDataCellEvent read FOnDrawDataCell write FOnDrawDataCell;
// procedure DoCalcCellColors(Field: TField; State: TGridDrawState;
// highlight: boolean; AFont: TFont; ABrush: TBrush); virtual;
procedure DoTitleButtonClick(AFieldName: string); virtual;
// procedure DoCalcTitleAttributes(AFieldName: string; AFont: TFont; ABrush: TBrush;
// var FTitleAlignment: TAlignment); virtual;
procedure DoDrawTitleCell(ACanvas: TCanvas;
Field: TField; ARect: TRect; var DefaultDrawing: boolean); virtual;
procedure DoDrawGroupHeaderCell(ACanvas: TCanvas;
GroupHeaderName: string; ARect: TRect; var DefaultDrawing: boolean); virtual;
procedure DoCalcTitleImage(Sender: TObject; Field: TField;
var TitleImageAttributes: TwwTitleImageAttributes); {$ifdef wwdelphi4up} virtual; {$endif}
{$ifdef wwDelphi4Up}
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
{$endif}
function UseRightToLeftAlignmentForField(const AField: TField;
Alignment: TAlignment): Boolean;
procedure UpdateScrollBar;
Function IsValidCell(ACol, ARow: integer): boolean;
function DbCol(col: integer): integer;
function DbRow(row: integer): integer;
procedure Draw3DLines(ARect: TRect; ACol, ARow: integer;
AState: TGridDrawState);
Function CellColor(ACol, ARow: integer): TColor; virtual;
procedure DrawCheckBox(ARect: TRect; ACol, ARow: integer; val: boolean); virtual;
procedure DrawCheckBox_Checkmark(ARect: TRect; ACol, ARow: integer; val: boolean);
procedure RefreshBookmarkList; virtual;
function CreateEditor: TInplaceEdit; override;
procedure HideControls; virtual;
property OnColWidthChanged: TColWidthChangedEvent read FOnColWidthChanged write FOnColWidthChanged;
property OnAllowColResize: TAllowColResizeEvent read FOnAllowColResize write FOnAllowColResize;
property OnColumnMoved: TMovedEvent read FOnColumnMoved write FOnColumnMoved;
Procedure UnselectAll; virtual;
Function IsSelectedCheckbox(ACol: integer): boolean;
procedure DataChanged; virtual;
Function IsSelectedRow(DataRow: integer): boolean; dynamic;
procedure DoTopRowChanged; virtual;
procedure DoRowChanged; virtual;
procedure DoCellChanged; virtual;
procedure DoCheckRowChanged; virtual;
{ Renamed property for C++ Builder conflicts }
property IndicatorButtonWidth: integer read FIndicatorWidth write SetIndicatorWidth;
{$ifdef win32}
{$ifdef wwDelphi3Up}
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
{$else}
procedure GetChildren(Proc: TGetChildProc); override;
{$endif}
{$else}
procedure WriteComponents(Writer: TWriter); override;
{$endif}
procedure TopLeftChanged; override;
function GetClientRect: TRect; override;
procedure Paint; override;
function GetControlType: TStrings;
procedure GetControlInfo(AFieldName: string;
var AControlType: string; var AParameters: string); virtual;
procedure DoFieldChanged(Field: TField); virtual;
procedure DoUpdateFooter; virtual;
Function GetFooterRect: TRect; virtual;
procedure CheckFooterUpdate; virtual;
procedure MouseMove(Shift: TShiftState; AX, AY: Integer); override;
procedure FreeHintWindow; virtual;
Function CreateHintWindow(AField: TField): THintWindow; virtual;
procedure ValidationErrorUsingMask(Field: TField); virtual;
procedure ChangeOrientation(RightToLeftOrientation: Boolean);
procedure DrawLines; virtual;
procedure PaintClickedTitleButton; virtual;
function AdjustBoundsRect(ACurrentCustomEdit: TWinControl): boolean;
procedure CalcSizingState(X, Y: Integer; var State: TGridState;
var Index: Longint; var SizingPos, SizingOfs: Integer;
var FixedInfo: TGridDrawInfo); override;
procedure InitCacheColInfo; virtual;
Function UseThemesInTitle: boolean;
function IsShortCut(var Message: TWMKey): Boolean;
// function CreateDataLink(AOwner: TComponent): TwwGridDataLink; virtual;
public
AlternatePaintBuffering: boolean;
SkipHideControls: boolean; { IP Internal - Set by TwwDBLookupCombo DropDown method }
SkipDataChange: boolean; { IP Internal - Set by TwwDBLookupComboDlg }
AlwaysShowControls: boolean; { Undocumented: when true controls will display even when grid is readonly}
// DragImages: TImageList;
// Indicators: TImageList;
MinRowHeightPercent:Integer; // Original rowheightpercent before user changes it
// New method for testing if row is painted with an altenrating color.
// Only applicable if PaintOptions.AlternatingRowColor is used.
function IsAlternatingRow(DBRow: integer): boolean;
property GroupFieldName: string read FGroupFieldName write SetGroupFieldName; // Data value Grouping
property RowOffset: integer read FRowOffset write SetRowOffset;
property TitleOffset: byte read FTitleOffset;
property CompareBookmarksAltMethod: boolean read
FCompareBookmarksAltMethod write FCompareBookmarksAltMethod default false;
// OriginalCellText: string;
procedure FillWithBlendBitmap(TempRect: TRect; CurRelRow: integer;
FillColor: TColor=clNone); virtual;
procedure FillWithFixedBitmap(TempRect: TRect; CurRelRow: integer;
FillColor: TColor=clNone); virtual;
procedure UpdateCustomEdit;
procedure ResetProportionalWidths;
Function ShouldShowCustomControls: boolean;
function CanEditGrid: Boolean; virtual;
procedure ClearURLPaint;
Function ActiveExpandButton: TWinControl;
procedure CalcDrawInfo(var DrawInfo: TGridDrawInfo); virtual;
function HasFocus: boolean; // Return true if we or a child of us has the focus;
function IsActiveRowAlternatingColor: boolean;
procedure CollapseChildGrid;
procedure AddField(FieldName: string;
Position: integer = -1; Redraw: boolean=True);
procedure RemoveField(FieldName: string; Redraw: boolean = True);
Function HaveAnyRowLines: boolean;
{$ifdef wwdelphi4up}
function ExecuteAction(Action: TBasicAction): Boolean; override; { 8/24/98 }
function UpdateAction(Action: TBasicAction): Boolean; override; {8/24/98}
{$endif}
procedure GetURLLink(Value: string;
var URLDisplayString: string; var URLLinkAddress: string); virtual;
Procedure InvalidateCurrentRow;
procedure InvalidateFooter;
procedure FlushChanges; virtual;
procedure UpdateRowCount;
procedure KeyDown(var Key: Word; Shift: TShiftState); override; {public to allow child to send keys to parent }
Procedure SizeLastColumn;
procedure BeginUpdate;
procedure EndUpdate(Repaint: boolean = false);
function IsCustomEditCell(col, row: integer; var customEdit: TWinControl) : boolean;
function TitleCellRect(ACol, ARow: Longint): TRect; virtual;
function GroupNameCellRect(ACol, ARow: Longint; var StartCol, EndCol: LongInt; VisibleOnly: boolean = True): TRect; virtual;
function DragTitleCellRect(ACol, x, y: Longint): TRect; virtual;
function CellRect(ACol, ARow: integer): TRect; virtual;
procedure RestoreRowHeights;
procedure ApplySelected; virtual;
Procedure PaintActiveRowBackground(ACanvas: TCanvas; ARect: TRect);
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function IsCheckBox(col,row: integer; var checkboxon, checkboxoff: string): boolean;
Function IsMemoField(Acol, Arow: integer): boolean; virtual; // 11/30/2001 - Made isMemoField virtual method.
Function IsSelected: boolean; dynamic;
function AllowPerfectFit: boolean;
Function DoPerfectFit: boolean;
Function DoShrinkToFit: boolean;
Procedure SelectRecord; virtual;
Procedure UnselectRecord; virtual;
Procedure SetPictureMask(FieldName: string; Mask: string);
Procedure SetPictureAutoFill(FieldName: string; AutoFill: boolean);
Procedure SetRegex(FieldName: string; Mask: string; CaseSensitive: boolean; ErrorMsg: string);
Procedure ClearLastBookmarks; { 5/2/00 - Add method to clear last bookmark values }
Function FieldName(Acol: integer): string;
Function GetHighlightColor: TColor;
function DittoField(SelectedField: TField; Direction: TwwDittoDirection=wwDittoPrior): boolean; virtual; // New method
procedure DefaultDrawDataCell(const Rect: TRect; Field: TField; State: TGridDrawState);
// 4/19/2001 - PYW - Moved so Exporting unit can call these events.
procedure DoCalcTitleAttributes(AFieldName: string; AFont: TFont; ABrush: TBrush;
var FTitleAlignment: TAlignment); virtual;
procedure DoCalcCellColors(Field: TField; State: TGridDrawState;
highlight: boolean; AFont: TFont; ABrush: TBrush); virtual;
procedure DoCalcCellColorsDetect(Field: TField; State: TGridDrawState;
highlight: boolean; AFont: TFont; ABrush: TBrush); virtual;
Function XIndicatorOffset: integer;
Function GetComponent(thisName: string): TWinControl;
function GetEffectiveFooterHeight: integer;
// 7/5/01 - Inherited MouseCoord does not work for Bide mode with fixed-editable
function MouseCoord(X, Y: Integer): TGridCoord;
Procedure AutoSizeColumn(ACol: integer); //virtual; // 5/15/03
function GetPriorRecordText(AFieldname: string; var AText: string): boolean;
function GetNextRecordText(AFieldname: string; var AText: string): boolean;
property DataLink: TwwGridDataLink read FDataLink;
property RowHeights;
property ColWidthsPixels[Index: Longint]: Integer read GetColWidthsPixels write SetColWidthsPixels;
property EditorMode;
property FieldCount: Integer read GetFieldCount;
property Fields[Index: Integer]: TField read GetFields;
property SelectedField: TField read GetSelectedField write SetSelectedField;
property SelectedIndex: Integer read GetSelectedIndex write SetSelectedIndex;
property IndicatorColor: TIndicatorColorType read FIndicatorColor write SetIndicatorColor;
property IndicatorIconColor: TColor read FIndicatorIconColor write SetIndicatorIconColor default clBlack;
property Options: TwwDBGridOptions read FOptions write SetOptions
default [dgEditing, dgTitles, dgIndicator, dgColumnResize, dgColLines,
dgRowLines,
dgTabs, dgConfirmDelete, dgCancelOnExit,
dgWordWrap{, dgVariableRowHeight}];
property KeyOptions : TwwDBGridKeyOptions read FKeyOptions write FKeyOptions
default [dgAllowInsert, dgAllowDelete];
property TitleAlignment: TAlignment read FTitleAlignment write setTitleAlignment;
property TitleLines : integer read FTitleLines write setTitleLines;
property OnCalcCellColors: TCalcCellColorsEvent read FOnCalcCellColors write FOnCalcCellColors;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -