📄 wwdbigrd.pas
字号:
private
FwwPicture: TwwDBPicture;
FWordWrap: boolean;
ParentGrid: TwwCustomDBGrid;
FUsePictureMask: boolean;
procedure WMSetFocus(var Message: TWMSetFocus); message WM_SETFOCUS;
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure WMPaste(var Message: TMessage); message WM_PASTE; {10/28/96 }
protected
procedure BoundsChanged; override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure CreateParams(var Params: TCreateParams); override;
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
procedure KeyPress(var Key: Char); override;
procedure SetWordWrap(val: boolean);
procedure UpdateContents; override;
public
constructor wwCreate(AOwner: TComponent; dummy: integer); virtual;
destructor Destroy; override;
function IsValidPictureValue(s: string): boolean;
Function HavePictureMask: boolean;
property Picture: TwwDBPicture read FwwPicture write FwwPicture;
property WordWrap: boolean read FWordWrap write SetWordWrap;
property Color;
property Font;
end;
TwwColumn = class
private
// FReadOnly: boolean;
// FDisplayLabel: string;
// FDisplayWidth: integer;
FFieldName: string;
Grid: TwwCustomDBGrid;
FFooterValue: string;
FGroupName: string;
FDisableSizing: boolean;
function GetReadOnly: boolean;
function GetDisplayLabel: string;
function GetDisplayWidth: integer;
function GetGroupName: string;
procedure SetReadOnly(val: boolean);
procedure SetDisplayLabel(val: string);
procedure SetDisplayWidth(val: integer);
procedure SetFooterValue(val: string);
procedure SetGroupName(val: string);
public
ColumnFlags: PByteArray; //array[0..255] of byte; // Support max 256 rows for line groupings
property FieldName: string read FFieldName;
property ReadOnly : boolean read GetReadOnly write SetReadOnly;
property DisplayLabel: string read GetDisplayLabel write SetDisplayLabel;
property DisplayWidth: integer read GetDisplayWidth write SetDisplayWidth;
property FooterValue: string read FFooterValue write SetFooterValue;
property GroupName: string read GetGroupName write SetGroupName;
property DisableSizing: boolean read FDisableSizing write FDisableSizing;
constructor Create(AOwner: TComponent; AFieldName: string);
destructor Destroy; override;
end;
TwwGridURLOpenEvent = procedure(
Sender : TObject; var URLLink: string; Field: TField;
var UseDefault: boolean) of object;
TwwPadColumnStyle = (pcsPlain, pcsPadHeader, pcsPadHeaderAndData);
TwwCacheColInfoItem = class
CustomControl: TWinControl;
ControlType: string;
ControlData: string;
AlwaysPaints: boolean;
IsWhiteBackground: boolean;
// PaintedBrushColor: TColor;
end;
TwwGridLineStyle= (glsSingle, gls3D, glsDynamic);
TwwGridLineColors = class(TPersistent)
private
FDataColor: TColor;
FHighlightColor: TColor;
FShadowColor: TColor;
FFixedColor: TColor;
published
property DataColor: TColor read FDataColor write FDataColor default clSilver;
property HighlightColor: TColor read FHighlightColor write FHighlightColor default clBtnHighlight;
property ShadowColor: TColor read FShadowColor write FShadowColor default clBtnShadow;
property FixedColor: TColor read FFixedColor write FFixedColor default clBlack;
end;
TwwDittoEvent = procedure(Sender : TObject;
DataSet: TDataSet; Field: TField;
var DittoValue: string;
var AllowDitto: boolean) of object;
TwwCustomDBGrid = class(TCustomGrid)
private
FGroupFieldName: string; // Data value Grouping
FOnDitto: TwwDittoEvent;
FDittoAttributes: TwwDittoAttributes;
FShowHorzScrollBar: boolean;
FOnBeforePaint: TNotifyEvent;
FSelected : TStrings;
FLineColors: TwwGridLineColors;
// FDataLineColor:TColor;
FTitleFont: TFont;
FTitleColor: TColor;
FFooterColor: TColor;
FFooterCellColor: TColor;
FFooterHeight: integer;
FReadOnly: Boolean;
FUserChange: Boolean;
// FDataChanged: Boolean;
// FEditRequest: Boolean;
FUpdatingColWidths: integer;
FOptions: TwwDBGridOptions;
FKeyOptions: TwwDBGridKeyOptions;
FTitleOffset: Byte;
FUpdateLock: Byte;
FInColExit: Boolean;
FDefaultDrawing: Boolean;
FSelfChangingTitleFont: Boolean;
FSelRow: Integer;
FDataLink: TwwGridDataLink;
// FVDataLink: TwwGridDataLink;
FOnColEnter: TNotifyEvent;
FOnColExit: TNotifyEvent;
FOnDrawDataCell: TwwDrawDataCellEvent;
FOnCalcCellColors: TCalcCellColorsEvent;
FOnCalcTitleAttributes: TCalcTitleAttributesEvent;
FOnDrawTitleCell: TwwDrawTitleCellEvent;
FOnDrawGroupHeaderCell: TwwDrawGroupHeaderCellEvent;
FOnCalcTitleImage: TwwCalcTitleImageEvent;
FOnTitleButtonClick: TTitleButtonClickEvent;
FOnCheckValue: TwwValidateEvent;
FOnTopRowChanged: TNotifyEvent;
FOnRowChanged: TNotifyEvent;
FOnCellChanged: TNotifyEvent;
FOnLeftColChanged: TwwLeftColChangedEvent;
FEditText: string;
FIndicatorColor: TIndicatorColorType;
FIndicatorIconColor: TColor;
FTitleAlignment: TAlignment;
FRowHeightPercent: Integer;
FTitleLines: integer;
FShowVertScrollBar: boolean;
FOnColumnMoved: TMovedEvent;
FOnColWidthChanged: TColWidthChangedEvent;
FOnAllowColResize: TAllowColResizeEvent;
FTitleButtons: boolean;
FEditCalculated : boolean;
FUseTFields: boolean;
FIndicatorWidth: integer;
FIndicatorButton: TwwIButton;
FImageList: TImageList;
FTitleImageList: TImageList;
FOnDrawFooterCell: TDrawFooterCellEvent;
FOnFieldChanged: TwwFieldChangedEvent;
FOnUpdateFooter: TNotifyEvent;
FOnCreateHintWindow: TwwCreateGridHintWindowEvent;
FOnURLOpen: TwwGridURLOpenEvent;
// FOnValidationErrorUsingMask: TwwPictureValidationError;
FSavePrevGridWidth:Integer;
FHideAllLines: boolean;
FSavedCursor:TCursor; // 4/9/2002 -PYW - Preserve Cursor before URLPaint
URLLinkActiveRow: integer;
URLLinkActiveCol: integer;
InUpdateRowCount: boolean;
FCalcCellRow, FCalcCellCol: integer;
isWhiteBackground: boolean;
isDrawFocusRect: boolean;
SkipLineDrawing: boolean;
TitleClickColumn: integer;
TitleClickRow: integer;
TitleClickGroupTitle:Boolean; // PYW - Added to determine if the enduser clicked on the TitleGroup button or the Title SubGroup Buttons.
MouseOverGroupTitle: boolean;
FMultiSelectOptions: TwwMultiSelectOptions;
DisableCellChangedEvent: boolean;
ColItems: TList;
{ Suport drag/drop of titles }
UseDragCanvas: boolean;
CaptureTitleBitmap: TBitmap;
FDragVertOffset: integer;
SkipTitleButtonClick: boolean;
FControlType: TStrings;
FControlInfoInDataset: boolean;
FPictureMasks: TStrings;
FRegexMasks: TStrings;
FPictureMaskFromDataSet: boolean;
CallColEnter: Boolean;
LastBookmark, LastMasterBookmark: TBookmark;
TempLastCol: integer; { Used when dataset is made active to fire ColEnter only once}
ShouldUpdateFooter: boolean;
DummyColumn: TwwColumn;
lastMouseX, lastMouseY: integer;
titleLastMouseX, titleLastMouseY: integer;
HintTimer: TTimer;
HintTimerCount: integer;
FUpdateCount: Integer;
FPadColumnStyle: TwwPadColumnStyle;
FPaintCanvas: TCanvas;
FPaintBitmap: TBitmap;
// Membitmap: HBitmap;
// UseTempCanvas: boolean;
FEditControlOptions: TwwEditControlOptions;
FPaintOptions: TwwGridPaintOptions;
UpdateRect: TRect;
ChangedBrushColor: boolean;
AlternatingEven: boolean;
FSizingIndex:Integer;
FPriorSizingWidth: integer;
FRowOffset: integer;
FLineStyle: TwwGridLineStyle;
ClickedOnGroupName:boolean;
ClickedOnGroupChild:boolean;
FCompareBookmarksAltMethod: boolean;
FOnBeforeDrawCell: TwwCustomDrawCellEvent;
FOnAfterDrawCell: TwwCustomDrawCellEvent;
FDisableThemesInTitle: boolean;
function CalcCoordFromPoint(X, Y: Integer;
const DrawInfo: TGridDrawInfo): TGridCoord;
procedure SetRowOffset(value: integer);
// FFocused: boolean;
procedure SetUseTFields(Val: boolean);
Function GetPictureControl: TComponent;
procedure HintTimerEvent(Sender: TObject);
procedure MouseLoop_DragColumn(HitTest: Integer; X, Y: Integer);
Function IsScrollBarVisible: boolean;
function AcquireFocus: Boolean;
procedure EditingChanged;
// function Edit: Boolean;
function GetDataSource: TDataSource;
function GetFieldCount: Integer;
function GetFields(Index: Integer): TField;
function GetSelectedField: TField;
function GetSelectedIndex: Integer;
procedure RecordChanged(Field: TField);
procedure FieldChanged(Field: TField);
procedure SetDataSource(Value: TDataSource);
procedure SetOptions(Value: TwwDBGridOptions);
procedure SetSelectedField(Value: TField);
procedure SetSelectedIndex(Value: Integer);
procedure SetTitleFont(Value: TFont);
procedure SetIndicatorIconColor(Value: TColor);
procedure SetTitleAlignment(sel: TAlignment);
procedure SetTitleLines(sel: integer);
procedure SetRowHeightPercent(sel: Integer);
Procedure SetShowVertScrollBar(val: boolean);
Procedure SetTitleButtons(val: boolean);
Function GetShowHorzScrollBar: Boolean;
Procedure SetShowHorzScrollBar(val: boolean);
function GetSelectedFields: TStrings;
procedure SetSelectedFields(sel : TStrings);
{ Procedure SetWordWrap(val: boolean);}
function GetColWidthsPixels(Index: Longint): Integer; {4/23/97}
procedure SetColWidthsPixels(Index: Longint; Value: Integer); {4/23/97}
procedure SetIndicatorWidth(val: integer);
procedure TitleFontChanged(Sender: TObject);
procedure UpdateData; //virtual;
procedure UpdateActive; //virtual;
{$ifdef wwDelphi4Up}
procedure WMEraseBkgnd(var Message: TWmEraseBkgnd); message WM_ERASEBkgnd;
{$endif}
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure CMExit(var Message: TMessage); message CM_EXIT;
procedure CMEnter(var Message: TCMEnter); message CM_ENTER;
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure CMParentFontChanged(var Message: TMessage); message CM_PARENTFONTCHANGED;
procedure CMDesignHitTest(var Msg: TCMDesignHitTest); message CM_DESIGNHITTEST;
procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR;
procedure WMSize(var Message: TWMSize); message WM_SIZE;
procedure WMVScroll(var Message: TWMVScroll); message WM_VSCROLL;
procedure WMRButtonDown(var Message: TWMRButtonDown); message WM_RBUTTONDOWN;
procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN;
procedure WMHScroll(var Msg: TWMHScroll); message WM_HSCROLL;
{$ifdef wwdelphi4up}
procedure CMShowingChanged(var Message: TMessage); message CM_SHOWINGCHANGED;
{$endif}
procedure WMPaint(var Message: TWMPaint); message WM_PAINT;
function GetFastColumn(Index: Integer): TwwColumn;
function GetColumn(Index: Integer): TwwColumn;
procedure SetFooterColor(sel: TColor);
procedure SetFooterCellColor(sel: TColor);
procedure SetFooterHeight(val: integer);
// function GetColumnByName(Index: string): TwwColumn;
function GetCanvas: TCanvas;
procedure SetPictureMasks(val: TStrings);
procedure SetRegexMasks(val: TStrings);
procedure SetControlType(val: TStrings);
procedure SetUpdateState(Updating: Boolean);
procedure InheritedPaint;
procedure SetIndicatorColor(Value: TIndicatorColorType);
function GetCalcCellRow: integer;
procedure CMCancelMode(var Message: TCMCancelMode); message CM_CANCELMODE;
procedure WMKillFocus(var Message: TWMKillFocus); message WM_KILLFOCUS;
{ procedure ModifyScrollBar(ScrollBar, ScrollCode, Pos: Cardinal;
UseRightToLeft: Boolean);
function CalcMaxTopLeft(const Coord: TGridCoord;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -