BpcDBBookMarkList

From RiskWiki

Jump to: navigation, search

TbpcBookmarkList - manages dataset bookmark lists

Language: Delphi 7 - 2007


TbpcBookmarkList loads a bookmark list from a TDataSet and supports management of the list independent of the TDataset including location, selection, tracking and deletion of underlying bookmarked dataset rows.


uses SysUtils, Db, Classes;

type

  TbpcBookmarkList = class
  private
    FList: TStringList;
    FDSet: TDataSet;
    FCache: TBookmarkStr;
    FCacheIndex: Integer;
    FCacheFind: Boolean;
    FLinkActive: Boolean;
    function GetCount: Integer;
    function GetCurrentRowSelected: Boolean;
    function GetItem(Index: Integer): TBookmarkStr;
    procedure SetCurrentRowSelected(Value: Boolean);
    procedure StringsChanged(Sender: TObject);
  protected
    function CurrentRow: TBookmarkStr;
    function Compare(const Item1, Item2: TBookmarkStr): Integer;
    procedure LinkActive(Value: Boolean);
  public
    constructor Create(ADSet: TDataSet);
    destructor Destroy; override;
    procedure Clear;           // free all bookmarks
    procedure Delete;          // delete all selected rows from dataset
    function  Find(const Item: TBookmarkStr; var Index: Integer): Boolean;
    function  IndexOf(const Item: TBookmarkStr): Integer;
    function  Refresh: Boolean;// drop orphaned bookmarks; True = orphans found
    property Count: Integer read GetCount;
    property CurrentRowSelected: Boolean read GetCurrentRowSelected
      write SetCurrentRowSelected;
    property Items[Index: Integer]: TBookmarkStr read GetItem; default;
  end;

BackLinks



CopyRight Bishop Phillips Consulting Pty Ltd 1997-2012 ( BpcDBBookMarkList )
Personal tools