Catalog · How the catalog works
tscrollboxlist
Virtual TScrollBox list for Delphi VCL
- ★ 4 on GitHub
Anyone may press Interesting, signed in or not. It helps others find this project.
README
TScrollBoxList

Virtual scroll box list for Delphi VCL
Display an unlimited number of TFrames within a TScrollBox with configurable cache, smooth scrolling and mouse-wheel support, keyboard navigation, and resize handling.
Current VCL usage
- Drop a TScrollBox on your form.
- Create a custom TFrame that displays your data elements as you normally would do.
- Create a function to dynamically create your frame. This can be something simple like this. (You will pass this function to the ScrollBoxList constructor and it will be used to create a new frame as needed.)
function MyFixedFrameCreate(const AOwner:TComponent; const AParent:TWinControl):TMyFixedHeightFrame;
begin
Result := TMyFixedHeightFrame.Create(AOwner);
Result.Parent := AParent;
Result.Name := '';
end;- Create a function to dynamically bind your data to your frame. (You will pass this function to the ScrollBoxList constructor and it will be used to populate the frame as needed.)
procedure MyFrameBind(const AView:TMyFixedHeightFrame; const AModel:TMyFixedData; const AIndex:Integer);
begin
AView.DoBind(AModel, AIndex); //typically just a forward
end;
//normal data-to-visual-control population
procedure TMyFixedHeightFrame.DoBind(const Item:TMyFixedData; const Index:Integer);
begin
Label2.Caption := Item.Title;
Label3.Caption := Item.Description;
Label4.Caption := Item.CurrentValue.ToString;
end;- Create a
TVariableHeightScrollBoxListinstance for variable item heights orTFixedHeightScrollBoxListfor rows with all the same heights. For example:TFixedHeightScrollBoxList<TMyFixedHeightFrame>.Create(ScrollBox1, {Height=}100, FFixedData.Count, MyFixedFrameCreate, MyDataFrameBind, CACHE_SIZE);
With two small/easy functions defined and one ScrollBoxList instance created, you can virtually scroll your data on a designated TScrollBox with a CACHE_SIZE number of TFrame instances that are dynamically built and populated as needed.
Currently a work-in-progress and more changes are in the works. The virtual list is currently assumed to be used for displaying read-only data.

<h5 align="center">

