📄 iwwebgrid.pas
字号:
FEditHint: string;
FPostHint: string;
FCancelHint: string;
procedure SetCancelButton(const Value: TBitmap);
procedure SetEditButton(const Value: TBitmap);
procedure SetPostButton(const Value: TBitmap);
public
constructor Create(AOwner: TTIWCustomWebGrid);
destructor Destroy; override;
published
property EditButton: TBitmap read FEditButton write SetEditButton;
property EditHint: string read FEditHint write FEditHint;
property PostButton: TBitmap read FPostButton write SetPostButton;
property PostHint: string read FPostHint write FPostHint;
property CancelButton: TBitmap read FCancelButton write SetCancelButton;
property CancelHint: string read FCancelHint write FCancelHint;
end;
TIntList = class(TList)
private
FOnChange: TNotifyEvent;
procedure SetInteger(Index: Integer; Value: Integer);
function GetInteger(Index: Integer): Integer;
function GetStrValue: string;
procedure SetStrValue(const Value: string);
public
constructor Create;
property Items[index: Integer]: Integer read GetInteger write SetInteger;
default;
procedure Add(Value: Integer);
procedure Delete(Index: Integer);
property StrValue: string read GetStrValue write SetStrValue;
published
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
TIWGridNode = class(TPersistent)
private
FOwner: TTIWCustomWebGrid;
FHintClosed: string;
FHintOpen: string;
FNodeOpen: TIPicture;
FNodeClosed: TIPicture;
procedure SetNodeClosed(const Value: TIPicture);
procedure SetNodeOpen(const Value: TIPicture);
public
constructor Create(AOwner: TTIWCustomWebGrid);
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
published
property NodeOpen: TIPicture read FNodeOpen write SetNodeOpen;
property NodeClosed: TIPicture read FNodeClosed write SetNodeClosed;
property HintOpen: string read FHintOpen write FHintOpen;
property HintClosed: string read FHintClosed write FHintClosed;
end;
TIWGridBackground = class(TPersistent)
private
FGradient1: TIWColor;
FGradient2: TIWColor;
FPicture: TIPicture;
FGradientDirection: TTIWGradientDirection;
procedure SetPicture(const Value: TIPicture);
public
constructor Create;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
published
property GradientDirection: TTIWGradientDirection read FGradientDirection
write FGradientDirection;
property Gradient1: TIWColor read FGradient1 write FGradient1;
property Gradient2: TIWColor read FGradient2 write FGradient2;
property Picture: TIPicture read FPicture write SetPicture;
end;
TIWGridClientEvents = class(TPersistent)
private
FButtonClick: TStringList;
FImageClick: TStringList;
FEditDone: TStringList;
FCellClick: TStringList;
FComboChange: TStringList;
FDynEditDone: TStringList;
FDynEditChange: TStringList;
FNodeClick: TStringList;
FDynComboChange: TStringList;
FDynCheckClick: TStringList;
FGridKeyDown: TStringList;
FPopupEditOk: TStringList;
FPopupEditCancel: TStringList;
FHoverRow: TStringList;
procedure SetButtonClick(const Value: TStringList);
procedure SetImageClick(const Value: TStringList);
procedure SetEditDone(const Value: TStringList);
procedure SetCellClick(const Value: TStringList);
procedure SetComboChange(const Value: TStringList);
procedure SetDynEditChange(const Value: TStringList);
procedure SetDynEditDone(const Value: TStringList);
procedure SetNodeClick(const Value: TStringList);
procedure SetDynComboChange(const Value: TStringList);
procedure SetDynCheckClick(const Value: TStringList);
procedure SetGridKeyDown(const Value: TStringList);
procedure SetPopupEditOk(const Value: TStringList);
procedure SetPopupEditCancel(const Value: TStringList);
procedure SetHoverRow(const Value: TStringList);
public
constructor Create;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
function GetJSFunction(PropName: string): string;
published
property ButtonClick: TStringList read FButtonClick write SetButtonClick;
property CellClick: TStringList read FCellClick write SetCellClick;
property EditDone: TStringList read FEditDone write SetEditDone;
property ImageClick: TStringList read FImageClick write SetImageClick;
property ComboChange: TStringList read FComboChange write SetComboChange;
property DynCheckClick: TStringList read FDynCheckClick write SetDynCheckClick;
property DynComboChange: TStringList read FDynComboChange write SetDynComboChange;
property DynEditChange: TStringList read FDynEditChange write SetDynEditChange;
property DynEditDone: TStringList read FDynEditDone write SetDynEditDone;
property NodeClick: TStringList read FNodeClick write SetNodeClick;
property GridKeyDown: TStringList read FGridKeyDown write SetGridKeyDown;
property PopupEditOk: TStringList read FPopupEditOk write SetPopupEditOk;
property PopupEditCancel: TStringList read FPopupEditCancel write SetPopupEditCancel;
property HoverRow: TStringList read FHoverRow write SetHoverRow;
end;
TTIWCustomWebGrid = class(TIWControl)
private
FRowOffset: Integer;
FPageOffset: Integer;
FNumRows: Integer;
FRowCount: Integer;
FColumns: TTIWWebGridColumns;
FController: TTIWAdvWebGridController;
FShowColumnHeader: Boolean;
FColumnHeaderColor: TIWColor;
FOnColumnHeaderClick: TIWRGColumnHeaderClick;
FPage: Integer;
FOnButtonClick: TIWRGButtonClick;
FSelectColor: TIWColor;
FHoverColor: TIWColor;
FHoverFontColor: TIWColor;
FSelectFontColor: TIWColor;
FHeaderStyle: TTIWHeaderStyle;
FOnGetCellData: TIWRGCellDataEvent;
FOnGetURLText: TIWRGCellDataEvent;
FOnGetCellProp: TIWRGCellPropEvent;
FDefaultRowHeight: Integer;
FColumnHeaderFont: TIWFont;
FColumnHeaderBorders: TTIWRGBorders;
FBands: TTIWAdvWebGridBands;
FOnCheckClick: TIWRGButtonClick;
FOnGetCellHint: TIWRGCellDataEvent;
FDecimalPoint: char;
FIndicators: TTIWRGIndicators;
FAdvanceOnReturn: Boolean;
FBorders: TTIWRGBorders;
FColumnSizing: Boolean;
FSortSettings: TTIWRGSortSettings;
FShowFooter: Boolean;
FFooterBorders: TTIWRGBorders;
FFooterColor: TIWColor;
FFooterFont: TIWFont;
FImages: TImageList;
FOnGetImageIdx: TTIWRGImageIndexEvent;
FOnImageClick: TIWRGButtonClick;
FAutoEdit: Boolean;
FMouseSelect: TTIWMouseSelect;
FEditColor: TIWColor;
FOnPrevPage: TNotifyEvent;
FOnFirstPage: TNotifyEvent;
FOnNextPage: TNotifyEvent;
FOnLastPage: TNotifyEvent;
FOnGotoPage: TTIWPageEvent;
FGlyphs: TTIWRGGlyphs;
FOnGotoRow: TTIWRowEvent;
FRadioSelection: Integer;
FScrollPos: Integer;
FScrollLeft: Integer;
FSelectList: TIntList;
FSelectPersistent: Boolean;
FStretchColumn: Integer;
FDynEdits: TStringList;
FOnFilterSelect: TTIWFilterEvent;
FOnGetDynText: TTIWGetDynText;
FOnCellClick: TIWRGButtonClick;
FID: Integer;
FIDS: string;
FEditID: Integer;
FDateSeparator: char;
FDateFormat: TTIWGridDateFormat;
FActiveRowColor: TIWColor;
FOnBeforeGotoLink: TTIWBeforeLinkEvent;
FOnAfterGotoLink: TTIWAfterLinkEvent;
FOnGetCellDetail: TIWRGCellDataEvent;
FActiveRowFontColor: TIWColor;
FCache: TStringList;
FActiveColumn: Integer;
FEditSelectAll: Boolean;
FCheckTruePicture: TIPicture;
FCheckFalsePicture: TIPicture;
FShowSelect: Boolean;
FDetailHeight: Integer;
FDetailRowShow: TTIWDetailRowShow;
FNodes: TIWGridNode;
FBackground: TIWGridBackground;
FOnGetCellPopupText: TIWRGCellDataEvent;
FClientEvents: TIWGridClientEvents;
FOnNodeOpen: TTIWRowEvent;
FOnNodeClose: TTIWRowEvent;
FOnValueClick: TIWRGCellValueEvent;
FScroll: TTIWWebGridScroll;
FRowHeader: TTIWWebGridRowHeader;
FOuterBorder: TTIWWebGridOuterBorder;
FDetailGrid: TTIWCustomWebGrid;
FNumDetails: Integer;
FDetailStates: TIntList;
dState: TTIWGridState;
FIsDetail: Boolean;
FAutoHTMLAdapt: Boolean;
FOnGetDetailGrid: TIWRGDetailGridEvent;
FOnSetCellData: TIWRGCellDataEvent;
FOnCanEditCell: TTIWCellAllowEvent;
FOnPost: TNotifyEvent;
FOnCancel: TNotifyEvent;
FOnEdit: TNotifyEvent;
FOnPostValidate: TTIWPostValidateEvent;
FOnDirectEditUpdate: TTIWDirectEditUpdate;
FPostData: TStringList;
FDirectPost: Boolean;
FUseFullHeight: Boolean;
FUseFullWidth: Boolean;
FFullHeight: Integer;
procedure SetRowCount(const Value: Integer);
procedure SetColumns(const Value: TTIWWebGridColumns);
procedure SetController(const Value: TTIWAdvWebGridController);
procedure SetShowColumnHeader(const Value: Boolean);
procedure SetColumnHeaderColor(const Value: TIWColor);
procedure SetPage(const Value: Integer);
function GetPage: Integer;
procedure SetHoverColor(const Value: TIWColor);
procedure SetHoverFontColor(const Value: TIWColor);
procedure SetSelectColor(const Value: TIWColor);
procedure SetSelectFontColor(const Value: TIWColor);
procedure SetDefaultRowHeight(const Value: Integer);
procedure SetColumnHeaderFont(const Value: TIWFont);
procedure SetBands(const Value: TTIWAdvWebGridBands);
function GetRowSelect(r: Integer): Boolean;
procedure SetIndicators(const Value: TTIWRGIndicators);
procedure SetBorders(const Value: TTIWRGBorders);
procedure SetColumnSizing(const Value: Boolean);
procedure SetSortSettings(const Value: TTIWRGSortSettings);
procedure SetFooterColor(const Value: TIWColor);
procedure SetFooterFont(const Value: TIWFont);
procedure SetShowFooter(const Value: Boolean);
procedure SetGlyphs(const Value: TTIWRGGlyphs);
procedure SetRowSelect(r: Integer; const Value: Boolean);
function GetDynEdits(col, row: Integer): string;
procedure SetDynEdits(col, row: Integer; const Value: string);
function HasSubTitles: Boolean;
function HasDetail: Boolean;
procedure SetID(const Value: Integer);
procedure SetCheckFalsePicture(const Value: TIPicture);
procedure SetCheckTruePicture(const Value: TIPicture);
procedure SetNodes(const Value: TIWGridNode);
procedure SetBackground(const Value: TIWGridBackground);
procedure SetClientEvents(const Value: TIWGridClientEvents);
procedure SetScroll(const Value: TTIWWebGridScroll);
function GetDetailStates(Row: Integer): Boolean;
procedure SetDetailStates(Row: Integer; const Value: Boolean);
function FontToTag(Font: TIWFont; s: string): string;
function FontUsed(Font: TIWFont): Boolean;
function GetActiveDetailRow: Integer;
procedure SetActiveDetailRow(const Value: Integer);
procedure SetRadioSelection(const Value: Integer);
function GradientStyle(Color1,Color2: TIWColor; Direction: TTIWGradientDirection):string;
function CellColor(Color,Color1,Color2: TIWColor; Direction: TTIWGradientDirection):string;
function RaisedStyle: string;
protected
ic: TIWHTMLPictureCache;
function ImageHTML(const ASrc: string; AWidth, AHeight: Integer; UseSize:
Boolean; Hint: string): TIWHTMLTag;
function OutputBMP(ACacheName: string; ABitmap: TBitmap; UseSize: Boolean;
Hint: string): string;
function OutputBMPEx(ACacheName: string; ABitmap: TBitmap; UseSize: Boolean;
Hint: string; Height, Width: Integer): string;
function OutputPIC(ACacheName: string; APicture: TIPicture; UseSize:
Boolean; Hint: string): string;
procedure SetRowOffset(AValue: Integer);
{$IFDEF TMSIW6}
procedure IWPaint; override;
{$ELSE}
procedure Paint; override;
{$ENDIF}
procedure DeleteSelection(i: Integer);
procedure DeleteRows(RowIndex,RowCount: Integer); virtual;
procedure InsertRows(RowIndex,RowCount: Integer); virtual;
procedure UpdateRowCount(const Value: Integer); virtual;
function GetCellData(ACol, ARow: Integer): string; virtual;
procedure SetCellData(ACol, ARow: Integer; Value: string); virtual;
function GetURLText(ACol, ARow: Integer; AValue: string): string; virtual;
function GetCellDetail(ACol, ARow: Integer): string; virtual;
function GetDetailGrid(ARow: Integer): TTIWCustomWebGrid; virtual;
function GetLookupValue(ACol: Integer; ACellValue: string): string; virtual;
function GetLookupValues(ACol: Integer; ACellValue: string): string; virtual;
function GetColumnTitle(ACol: Integer): string; virtual;
function GetGridState: TTIWGridState; virtual;
procedure GetRowInfo(var NumRows, RowOffset, PageOffset: Integer); virtual;
procedure RenderPrepareDetail(AGrid: TTIWCustomWebGrid); virtual;
function RenderPrepare: Boolean; virtual;
procedure RenderDone; virtual;
procedure DoEdit; virtual;
procedure DoCancel; virtual;
function DoPost: Boolean; virtual;
procedure DoInsert; virtual;
procedure DoNodeOpen(ARow: Integer); virtual;
procedure DoNodeClose(ARow: Integer); virtual;
procedure GotoRecord(RecordIndex: Integer); virtual;
procedure NextRecord; virtual;
function DirectEditUpdate(ACol,ARow: Integer;var Value: string): Boolean; virtual;
procedure Submit(const AValue: string); override;
procedure SetValue(const AValue: string); override;
function HTMLClr(AColor: TIWColor): string;
procedure GetCellProp(RowIndex, ColumnIndex: Integer; AValue: string;
var AColor: TIWColor; var AAlignment: TAlignment; AFont: TIWFont); virtual;
procedure Notification(AComponent: TComponent; AOperation: TOperation); override;
function DateStrToDate(AValue: string): TDateTime;
function DateToDateStr(AValue: TDateTime): string;
function RenderCalendar(Name: string; Width: Integer; AFontName: string;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -