BpcDBGrid

From RiskWiki
Jump to: navigation, search

bpcDBGrid - Modified InfoPower WW grid to support column sorting

Language: Delphi 7 - 2007

Another modified W2W InfoPower component. This time to support "click on title" column sorting in DB aware grids.


uses
  Windows, Messages, SysUtils, Classes, Controls, Grids, Wwdbigrd, Wwdbgrid, Forms,
  ADODB, DB, Dialogs;

type
  TbpcDBGrid = class(TwwDBGrid)
  private
    { Private declarations }
    FTitleSort: boolean;
    FslColumns : TStringList;
    FOriginalCommandText : string;
    procedure MyOnTitleButtonClick(Sender: TObject; AFieldName: string);
    function ValidSortField(AFieldName: string) : boolean;
    function ValidFieldDataType(AFieldDataType : TDataType): Boolean;
  protected
    { Protected declarations }
    procedure SortGrid(AFieldName : string);
    procedure StoreOriginalCommandText;
  public
    { Public declarations }
    procedure CancelSort;
  published
    { Published declarations }
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    property TitleSort : boolean read FTitleSort write FTitleSort default True;

  end;

BackLinks