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

📄 iwwebgrid.pas

📁 TMS IntraWEb增强控件TMSIntraWeb_v2.3.2.1_D2007.rar
💻 PAS
📖 第 1 页 / 共 5 页
字号:
      AFontSize: Integer; blurevent, cellvalue: string; AColor: TIWColor): string;
    function RenderSpin(Name: string; MaxLength, Width: Integer; Alignment: TAlignment;
      AFontStyle: string; CellValue: string; AColor: TIWColor;
      MaxValue: Integer; MinValue: Integer; AutoSpin: Boolean;
      blurevent: string): string;
    function SubmitCall(Param: string): string;
    function GetTableWidth(inner: Boolean): Integer;
    function GetVisibleCols: Integer;
    function GetController: string;
    function GetScrollBarStyle(Scroll: TTIWWebGridScroll): string;
    function GetRowHeader(NumRows,GridHeight: Integer): string;
    procedure ControllerChanged(Sender: TObject);
    {$IFDEF TMSIW6}
    function RenderString(Master: Boolean; AContext: TIWBaseComponentContext): string;
    {$ELSE}
    function RenderString(Master: Boolean): string;
    {$ENDIF}
    property IDS: string read FIDS;
    property IsDetail: Boolean read FIsDetail write FIsDetail;
    property IDDetail: Integer read FEditID;
    property PostValues: TStringList read FPostData;
    function HasDynEdits: Boolean;
    function HasPercCols: Boolean;
    function HasColSpans: Boolean;
    property DirectPost: Boolean read FDirectPost write FDirectPost;
    property FullHeight: Integer read FFullHeight write FFullHeight;
    property NumDetails: Integer read FNumDetails write FNumDetails;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    {$IFDEF TMSIW6}
    function RenderHTML(AContext: TIWBaseComponentContext): TIWHTMLTag; override;
    {$ELSE}
    function RenderHTML: TIWHTMLTag; override;
    {$ENDIF}
    function HTMLAdapt(Value: string): string; virtual;
    function HTMLAdaptInv(Value: string): string; virtual;
    procedure SetBounds(ALeft,ATop,AWidth,AHeight: Integer); override;
    procedure ClearRowSelect;
    procedure ClearDynEdits;
    procedure ClearDetailStates;
    procedure Edit; virtual;
    procedure ColumnHeaderClick(AColumn: Integer); virtual;
    function CreateColumns: TTIWWebGridColumns; virtual;
    property RowSelect[r: Integer]: Boolean read GetRowSelect write SetRowSelect;
    property RowOffset: Integer read FRowOffset;
    property Row: Integer read FPageOffset;
    property RowTot: Integer read FNumRows;
    property RadioSelection: Integer read FRadioSelection write SetRadioSelection;
    property DynEdits[Col, Row: Integer]: string read GetDynEdits write SetDynEdits;
    property DetailStates[Row: Integer]: Boolean read GetDetailStates write SetDetailStates;
    property ActiveColumn: Integer read FActiveColumn write FActiveColumn;
    property ActiveDetailRow: Integer read GetActiveDetailRow write SetActiveDetailRow;
    function GetVersionNr: Integer; virtual;
    function GetVersionString: string; virtual;
    procedure Invalidate; override;
  published
    property ActiveRowColor: TIWColor read FActiveRowColor write FActiveRowColor;
    property ActiveRowFontColor: TIWColor read FActiveRowFontColor write
      FActiveRowFontColor;
    property AdvanceOnReturn: Boolean read FAdvanceOnReturn write FAdvanceOnReturn;
    property AutoEdit: Boolean read FAutoEdit write FAutoEdit;
    property AutoHTMLAdapt: Boolean read FAutoHTMLAdapt write FAutoHTMLAdapt;
    property Background: TIWGridBackground read FBackground write SetBackground;
    property Bands: TTIWAdvWebGridBands read FBands write SetBands;
    property Borders: TTIWRGBorders read FBorders write SetBorders;
    property CheckTruePicture: TIPicture read FCheckTruePicture write SetCheckTruePicture;
    property CheckFalsePicture: TIPicture read FCheckFalsePicture write SetCheckFalsePicture;
    property ClientEvents: TIWGridClientEvents read FClientEvents write SetClientEvents;
    property Color;
    property Columns: TTIWWebGridColumns read FColumns write SetColumns;
    property ColumnHeaderColor: TIWColor read FColumnHeaderColor write SetColumnHeaderColor;
    property ColumnHeaderFont: TIWFont read FColumnHeaderFont write SetColumnHeaderFont;
    property ColumnHeaderBorders: TTIWRGBorders read FColumnHeaderBorders write FColumnHeaderBorders;  
    property ColumnSizing: Boolean read FColumnSizing write SetColumnSizing;
    property Controller: TTIWAdvWebGridController read FController write SetController;
    property DateSeparator: char read FDateSeparator write FDateSeparator;
    property DateFormat: TTIWGridDateFormat read FDateFormat write FDateFormat;
    property DecimalPoint: char read FDecimalPoint write FDecimalPoint;
    property DefaultRowHeight: Integer read FDefaultRowHeight write SetDefaultRowHeight;
    property DetailGrid: TTIWCustomWebGrid read FDetailGrid write FDetailGrid;
    property DetailRowHeight: Integer read FDetailHeight write FDetailHeight;
    property DetailRowShow: TTIWDetailRowShow read FDetailRowShow write
      FDetailRowShow;
    property EditColor: TIWColor read FEditColor write FEditColor;
    property EditSelectAll: Boolean read FEditSelectAll write FEditSelectAll;
    property FooterBorders: TTIWRGBorders read FFooterBorders write FFooterBorders;          
    property FooterColor: TIWColor read FFooterColor write SetFooterColor;
    property FooterFont: TIWFont read FFooterFont write SetFooterFont;
    property Font;
    property Glyphs: TTIWRGGlyphs read FGlyphs write SetGlyphs;
    property HoverColor: TIWColor read FHoverColor write SetHoverColor;
    property HoverFontColor: TIWColor read FHoverFontColor write
      SetHoverFontColor;
    property HeaderStyle: TTIWHeaderStyle read FHeaderStyle write FHeaderStyle;   
    property ID: Integer read FID write SetID;
    property Images: TImageList read FImages write FImages;
    property Indicators: TTIWRGIndicators read FIndicators write SetIndicators;
    property MouseSelect: TTIWMouseSelect read FMouseSelect write FMouseSelect;
    property Nodes: TIWGridNode read FNodes write SetNodes;
    property OuterBorder: TTIWWebGridOuterBorder read FOuterBorder write FOuterBorder;
    property Page: Integer read GetPage write SetPage;
    property RowCount: Integer read FRowCount write SetRowCount;
    property RowHeader: TTIWWebGridRowHeader read FRowHeader write FRowHeader;
    property Scroll: TTIWWebGridScroll read FScroll write SetScroll;
    property SelectColor: TIWColor read FSelectColor write SetSelectColor;
    property SelectFontColor: TIWColor read FSelectFontColor write
      SetSelectFontColor;
    property SelectPersistent: Boolean read FSelectPersistent write FSelectPersistent default True;
    property ShowColumnHeader: Boolean read FShowColumnHeader write
      SetShowColumnHeader;
    property ShowFooter: Boolean read FShowFooter write SetShowFooter;
    property ShowSelect: Boolean read FShowSelect write FShowSelect;
    property SortSettings: TTIWRGSortSettings read FSortSettings write
      SetSortSettings;
    property StretchColumn: Integer read FStretchColumn write FStretchColumn;
    property TabOrder;
    property UseFullHeight: Boolean read FUseFullHeight write FUseFullHeight;
    property UseFullWidth: Boolean read FUseFullWidth write FUseFullWidth;
    property OnAfterGotoLink: TTIWAfterLinkEvent read FOnAfterGotoLink write
      FOnAfterGotoLink;
    property OnBeforeGotoLink: TTIWBeforeLinkEvent read FOnBeforeGotoLink write
      FOnBeforeGotoLink;
    property OnButtonClick: TIWRGButtonClick read FOnButtonClick write
      FOnButtonClick;
    property OnCanEditCell: TTIWCellAllowEvent read FOnCanEditCell write
      FOnCanEditCell;
    property OnCellClick: TIWRGButtonClick read FOnCellClick write FOnCellClick;
    property OnValueClick: TIWRGCellValueEvent read FOnValueClick write FOnValueClick;
    property OnCheckClick: TIWRGButtonClick read FOnCheckClick write
      FOnCheckClick;
    property OnColumnHeaderClick: TIWRGColumnHeaderClick read
      FOnColumnHeaderClick write FOnColumnHeaderClick;
    property OnFilterSelect: TTIWFilterEvent read FOnFilterSelect write
      FOnFilterSelect;
    property OnGetCellData: TIWRGCellDataEvent read FOnGetCellData write
      FOnGetCellData;
    property OnGetCellDetail: TIWRGCellDataEvent read FOnGetCellDetail write
      FOnGetCellDetail;
    property OnGetCellProp: TIWRGCellPropEvent read FOnGetCellProp write
      FOnGetCellProp;
    property OnGetCellHint: TIWRGCellDataEvent read FOnGetCellHint write
      FOnGetCellHint;
    property OnGetCellPopupText: TIWRGCellDataEvent read FOnGetCellPopupText
      write FOnGetCellPopupText;
    property OnGetDynText: TTIWGetDynText read FOnGetDynText write
      FOnGetDynText;
    property OnGetDetailGrid: TIWRGDetailGridEvent read FOnGetDetailGrid write
      FOnGetDetailGrid;
    property OnGetURLText: TIWRGCellDataEvent read FOnGetURLText write
      FOnGetURLText;
    property OnGetImageIdx: TTIWRGImageIndexEvent read FOnGetImageIdx write
      FOnGetImageIdx;
    property OnImageClick: TIWRGButtonClick read FOnImageClick write
      FOnImageClick;
    property OnSetCellData: TIWRGCellDataEvent read FOnSetCellData write
      FOnSetCellData;
    property OnNextPage: TNotifyEvent read FOnNextPage write FOnNextPage;
    property OnPrevPage: TNotifyEvent read FOnPrevPage write FOnPrevPage;
    property OnFirstPage: TNotifyEvent read FOnFirstPage write FOnFirstPage;
    property OnLastPage: TNotifyEvent read FOnLastPage write FOnLastPage;
    property OnGotoPage: TTIWPageEvent read FOnGotoPage write FOnGotoPage;
    property OnGotoRow: TTIWRowEvent read FOnGotoRow write FOnGotoRow;
    property OnNodeOpen: TTIWRowEvent read FOnNodeOpen write FOnNodeOpen;
    property OnNodeClose: TTIWRowEvent read FOnNodeClose write FOnNodeClose;
    property OnEdit: TNotifyEvent read FOnEdit write FOnEdit;
    property OnCancel: TNotifyEvent read FOnCancel write FOnCancel;
    property OnPost: TNotifyEvent read FOnPost write FOnPost;
    property OnPostValidate: TTIWPostValidateEvent read FOnPostValidate write FOnPostValidate;
    property OnDirectEditUpdate: TTIWDirectEditUpdate read FOnDirectEditUpdate write FOnDirectEditUpdate;
  end;


{$IFDEF LINUX}
function MakeLong(hi_, lo_: Integer): Integer;
function MakeWord(hi_, lo_: Byte): SmallInt;
function LoWord(t: Integer): word;
function HiWord(t: Integer): word;
{$ENDIF}

implementation

uses
  {$IFNDEF LINUX}
  ImgList, ShellAPI, CommCtrl,
  {$ENDIF}
  IWApplication, IWServerControllerBase,
  SWStrings, SWSystem, IWAppForm, Math, IWServer
  {$IFDEF TMSIW7}
  , IWBaseHTMLControl
  {$ENDIF}
  ;

{$DEFINE REMOVESTRIP}
{$DEFINE REMOVEDRAW}

{$IFDEF LINUX}
{$I QHTMLENG.PAS}
{$ELSE}
{$I iwhtmleng.pas}
{$ENDIF}

{$IFDEF LINUX}

function MakeLong(hi_, lo_: Integer): Integer;
begin
  Result := ((hi_ shl 16) and $FFFF0000) or (Lo_ and $0000FFFF);
end;

function LoWord(t: Integer): word;
begin
  Result := t and $0000FFFF;
end;

function HiWord(t: Integer): word;
begin
  Result := (t and $FFFF0000) shr 16;
end;

function MakeWord(hi_, lo_: Byte): SmallInt;
begin
  Result := hi_;
  Result := (Result shl 8) + lo_;
end;

{$ENDIF}

{ TIntList }

constructor TIntList.Create;
begin
  inherited Create;
end;

procedure TIntList.SetInteger(Index: Integer; Value: Integer);
begin
  if Index < 0 then
    Exit;

  while Index >= Count do
  begin
    Add(0);
  end;

  inherited Items[Index] := Pointer(Value);
  if Assigned(OnChange) then
    OnChange(Self);
end;

function TIntList.GetInteger(Index: Integer): Integer;
begin
  Result := 0;
  if Index < 0 then
    Exit;

  while Index >= Count do
  begin
    Add(0);
  end;

  Result := Integer(inherited Items[Index]);
end;

procedure TIntList.Add(Value: Integer);
begin
  inherited Add(Pointer(Value));
  if Assigned(OnChange) then
    OnChange(Self);
end;

procedure TIntList.Delete(Index: Integer);
begin
  inherited Delete(Index);
  if Assigned(OnChange) then
    OnChange(Self);
end;

function TIntList.GetStrValue: string;
var
  i: integer;
begin
  for i := 1 to Count do
    if i = 1 then
      Result := IntToStr(Items[i - 1])
    else
      Result := Result + ',' + IntToStr(Items[i - 1]);
end;

procedure TIntList.SetStrValue(const Value: string);
var
  sl: TStringList;
  i: Integer;
begin
  sl := TStringList.Create;
  sl.CommaText := Value;
  Clear;
  for i := 1 to sl.Count do
    Add(StrToInt(sl.Strings[i - 1]));
  sl.Free;
end;

{ TTIWCustomWebGrid }

constructor TTIWCustomWebGrid.Create(AOwner: TComponent);
var
  i,maxid: Integer;

begin
  inherited;
  // General IW control settings
  {$IFDEF TMSIW6}
  SetRenderSize(True);
  {TODO}
  {$ELSE}
  FRenderSize := True;
  FSupportsSubmit := True;
  FSupportsInput := True;
  {$ENDIF}

  ic := TIWHTMLPictureCache.Create;
  ic.DesignLive := True;
  FColumns := CreateColumns;
  FRowCount := 10;
  FController := TTIWAdvWebGridController.Create;
  FController.OnChange := ControllerChanged;
  FController.FControllerBorders := TTIWRGBorders.Create(Self);
  FController.FControllerBorders.FCollapsed := true;
  FIndicators := TTIWRGIndicators.Create(Self);
  FBorders := TTIWRGBorders.Create(Self);
  FBorders.FCollapsed := true;

⌨️ 快捷键说明

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