I'm using a TCheckListBox with quite a few items in it (200+).
When at least one item has been checked, I'd like the list to scroll that item to the top (only at the form.onShow event - not while checking items).
No matter what I try, I seem to be unable to accomplish this.
What I have tried:
TCheckListBox.TopIndex := X;
This only works when the checked item is not yet visible.
TCheckListBox.ItemIndex := X;
TCheckListBox.MakeCurrentVisible;
This only scrolls the selected item into the visible area, as expeced, which often results the checked row to appear at the bottom of the visible area.
TCheckListBox.ScrollBy(0, Y); // Y being an arbitrary number
This doesn't do anything at all, Y being positive or negative ... nothing happens.
TCheckListBox.ScrollBy)WS(0, Y); // Y being an arbitrary number
I'm not sure what the purpose of this is, but the error "
TWinControl.ScrollBy_WS: Handle not allocated" indicates that I cannot use this with Cocoa [see:
documentation]).
I have no access to the vertical scrollbar with TChecListBox.
Does anyone know how this can be accomplished?
Or is this a bug as I would assume setting "
TopIndex" would do what I'm looking for (documentation says:
Index of the first visible (or top-most) item)?
For reference:
Lazarus 4.99 (rev main_4_99-3421-g449b0a887c) FPC 3.3.1 x86_64-darwin-cocoa, macOS Tahoe 26.4.1 using the latest Commandline Tools.