Reference TScrollList
Declared in Codebot.Controls.Scrolling.pas on line 222
TScrollList is a custom scrolling list control
TScrollList = class(TSurfaceCustomControl)
protected
procedure CreateHandle; override;
{ Invoked when HeaderSize changes }
procedure DoHeaderResize; virtual;
{ Invoked when the mouse moves while captured }
procedure CaptureMove(X, Y: Integer); virtual;
procedure KeyPress(var Key: Char); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseLeave; override;
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
{ Invoke OnScrollLeft }
procedure DoScrollLeft; virtual;
procedure Resize; override;
procedure Draw; override;
{ Draw the area behind the items }
procedure DrawBackground(const Rect: TRectI); virtual;
{ Draw an item }
procedure DrawItem(Index: Integer; var Rect: TRectI; State: TDrawState); virtual;
{ Update the scroll bars to match the item count and size }
procedure UpdateScrollRange;
{ Scroll by a number of pixels }
procedure Scroll(Delta: Integer); virtual;
{ Scroll while the mouse is dragged above or below the list }
procedure ScrollMove(Distance: Integer; Direction: TScrollDir); virtual;
{ Invoked before the item index changes, set CanSelect to false to prevent
it }
procedure SelectItem(PriorIndex: Integer; NewIndex: Integer; var CanSelect: Boolean); virtual;
{ The item where the mouse was pressed }
property DownIndex: Integer read FDownIndex;
{ The number of items }
property Count: Integer read FCount write SetCount;
{ A hint window shown over the list }
property HintWindow: TControlHintWindow read FHintWindow;
{ The item under the mouse or -1 }
property HotIndex: Integer read FHotIndex;
{ When true the item under the mouse is highlighted }
property HotTrack: Boolean read FHotTrack write SetHotTrack;
{ When true the list ignores the mouse }
property MouseDisabled: Boolean read FMouseDisabled write SetMouseDisabled;
{ When true more than one item can be selected }
property MultiSelect: Boolean read FMultiSelect write SetMultiSelect;
{ When true positions outside the client width do not match an item }
property InsideRect: Boolean read FInsideRect write FInsideRect;
{ The height of each item }
property ItemHeight: Integer read FItemHeight write SetItemHeight default 16;
{ The focused item or -1 }
property ItemIndex: Integer read FItemIndex write SetItemIndex;
{ When true the mouse only matches the current item }
property Locked: Boolean read FLocked write FLocked;
{ Scrolling is true while the mouse drags beyond the list }
property Scrolling: Boolean read FScrolling write SetScrolling;
{ The selected state of an item when MultiSelect is true }
property Selected[Index: Integer]: Boolean read GetSelected write SetSelected;
{ The number of selected items }
property SelectCount: Integer read FSelectCount;
{ The first visible item }
property TopIndex: Integer read FTopIndex write SetTopIndex;
{ OnSelectItem is invoked when an item is chosen }
property OnSelectItem: TNotifyEvent read FOnSelectItem write FOnSelectItem;
{ OnScrollLeft is invoked when the horizontal scroll position changes }
property OnScrollLeft: TNotifyEvent read FOnScrollLeft write FOnScrollLeft;
public
{ Create a new scroll list }
constructor Create(AOwner: TComponent); override;
{ Return the bounds of an item }
function ItemRect(Item: Integer): TRectI;
{ Return the item at a point. When Existing is false points below the last
item return the last item. }
function ItemAtPos(const Pos: TPointI; Existing: Boolean = False): Integer;
procedure ScrollBy(DeltaX, DeltaY: Integer); override;
{ Scroll so the item index is visible }
procedure InsureItemVisible;
{ Repaint an item }
procedure InvalidateItem(Item: Integer);
{ Returns true if an item is selected }
function IsSelected(Index: Integer): Boolean;
{ Invoke OnSelectItem }
procedure Select;
{ Scroll so the item index is visible }
procedure ScrollToSelection;
{ Space reserved above the items for a header }
property HeaderSize: Integer read FHeaderSize write SetHeaderSize;
{ The width of the horizontally scrollable area }
property ScrollWidth: Integer read FScrollWidth write SetScrollWidth;
{ The horizontal scroll position }
property ScrollLeft: Integer read FScrollLeft write SetScrollLeft;
end;See also
TDrawState in Codebot.Graphics.Types.pas
TPointI in Codebot.Graphics.Types.pas
TRectI in Codebot.Graphics.Types.pas
TSurfaceCustomControl in Codebot.Controls.pas