Hugo Bendtner 0 Posted December 22, 2021 Having recently upgraded to Delphi 10.4, I'm experimenting with various controls and currently looking at the TControlList (without LiveBindings). A few questions: Using TControlList with vertically aligned controls in a single column, when manually specifying the ItemIndex it jumps to the item, is there any way to make the scrollbars move so that the selected item is displayed at the top of the list? Currently if the item is off screen it scrolls to the item and the item is shown last. Is there any way to catch when the Selected item (ItemIndex) has changed? Or have I got to put in events for both onClick and onKeyPress etc? Is using ItemIndex the only way to find out what item has been selected? I assume I can never scroll through the list of items because they are all virtual? Share this post Link to post
Lajos Juhász 295 Posted December 22, 2021 I've tested with Delphi 10.4.2 1. A dirty trick would be first set the ItemIndex under the control you would like to select on the top: ControlList1.ItemIndex:=40+(ControlList1.Height div ControlList1.ItemHeight); ControlList1.ItemIndex:=40; 2. OnItemClicked is fired when the itemIndex changes (both from code or user navigation). Share this post Link to post
Serge_G 87 Posted December 23, 2021 Hi, if you read French (or if you can translate it easily) I wrote some posts, sort of "Deep Diving in TControlList" in my blog starting from this one. I am certain you will find some clues in this post 1 Share this post Link to post
Hugo Bendtner 0 Posted December 23, 2021 Thanks, Serge_G (Google Translate does the trick!). I was fearful that I may have to extend the TControlList class, and that looks to be what you've done, because bizarrely the most useful functions are private. Share this post Link to post
Serge_G 87 Posted December 23, 2021 2 minutes ago, Hugo Bendtner said: I was fearful that I may have to extend the TControlList class, and that looks to be what you've done, because bizarrely the most useful functions are private Yes, I was a little disappointed with all those needed private functions but was too lazy to suggest changes in the Quality portal Share this post Link to post
Hugo Bendtner 0 Posted December 30, 2021 Does anyone know if TControlLists can handle transparency? I would like to have a watermark underneath and whereas TPanels with clNone as their color are essentially transparent, the TControlList displays black. Messing around with ParentColor doesn't have desired results either. Share this post Link to post
PeterBelow 239 Posted December 31, 2021 18 hours ago, Hugo Bendtner said: Does anyone know if TControlLists can handle transparency? I would like to have a watermark underneath and whereas TPanels with clNone as their color are essentially transparent, the TControlList displays black. Messing around with ParentColor doesn't have desired results either. Tcontrollist inherits the ParentBackground property but does not publish it, it is protected. You can try to set it to true in code, using a cracker class: type TControllistCracker = class(TControllist); ... TControllistcracker(Controllist1).Parentbackground := true; Untested! Share this post Link to post