TListBox: how to draw SpeedButton over it? lazarus / 31-LCL ---------------------------------------------------------------------- DL4OCE · 2013-02-26 17:21 Hi, I have a ListBox and want to lay a SpeedButton over it. But whatever I am trying to do (change Z-index, for example), it won't let me pull the button over the ListBox, it will always draw the button under the ListBox. Any idea? ---------------------------------------------------------------------- typo · 2013-02-26 17:33 Why do you need a TSpeedButton over it and not a TButton, for example? ---------------------------------------------------------------------- Avishai · 2013-02-26 17:42 Could you use a TBitBtn?  Even then I think you will have problems.  TListBox.Items being under the Button...  ScrollBar under Button.  Maybe place a button above the TListBox. ---------------------------------------------------------------------- DL4OCE · 2013-02-26 19:52 That's exactly what I am trying to do. It does not have to be a part of the ListBox. Won't fit in a ListBox row, anyway. It's just a button that must stay above the ListBox. ---------------------------------------------------------------------- Avishai · 2013-02-26 20:15 Now I'm more confused than before.  If you place the Button next to the ListBox, it should stay where you put it.  I must be missing something.  But anyway, in code you can use: Code: [Select]procedure TForm1.FormShow(Sender: TObject); begin   Button1.AnchorToCompanion(akBottom,0,ListBox1); end; Edit:  Maybe you are talking about at Design time??  If so you can hold down Shift Key and Select multiple components and move/delete/copy... them all at once. ---------------------------------------------------------------------- DL4OCE · 2013-02-26 20:23 I knew I would .. Please have a look at the attached image - it shows the (white) ListBox and the SpeedButton which refuses to stay on top (but that's where I wanna have it). ---------------------------------------------------------------------- Avishai · 2013-02-26 20:33 Ah.  Now I understand.  You want it "In Front" of the ListBox.  This is a workaround but:  Add a TPanel and put in in front.  Add Button to TPanel.  Set TPanel.BevelOuter:= bvNone. and TPanel.AutoSize:= True. ---------------------------------------------------------------------- DL4OCE · 2013-02-26 21:06 This is ugly (hope I can fix this) but it works! Thank you very much! ---------------------------------------------------------------------- Avishai · 2013-02-26 21:14 TSpeedButton descends from TGraphicControl so I'm not too sure you will find a more elegant solution, but that shouldn't keep you from trying   Anyway I'm glad you're back on track. ---------------------------------------------------------------------- CaptBill · 2013-02-26 21:52 Quote from: DL4OCE on February 26, 2013, 10:06:12 pmThis is ugly (hope I can fix this) but it works! Thank you very much! This is actually a best practice. You are applying the OO principal of "containment"  at the drawing level.