⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wwdbigrdtest.pas

📁 胜天进销存源码,国产优秀的进销存
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    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;

    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.

    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;
    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;
    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;

    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;
    procedure UpdateActive;
    {$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 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 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;
      const DrawInfo: TGridDrawInfo): TGridCoord;
}
    function CalcMaxTopLeft(const Coord: TGridCoord;
     const DrawInfo: TGridDrawInfo): TGridCoord;
  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;

    {$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;
    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;

    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}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -