I’m working on Firemonkey application with a main form that contains a lot of controls on it. I want to create some more controls and send them to back using SendToBack. For some reason this does not work as expected. Controls are not being sent to full back, they stop short of 1 control.
Here’s a sample setup:
Create a new TForm.
Place 3 Buttons on it, overlapping each other (Button1, Button2, Button3).
In the runtime, call Button3.SendToBack – button goes back, but only by 1 position. Button1 still remains the backmost.
Inspecting TForm source code reveals that SendToBack calls SendChildToBack, which determines backmost location as:
function TCommonCustomForm.GetBackIndex: Integer;
Result := 1;
should not it be 0?
Why does SendToBack send controls to “last but one” position instead of backmost? Is there a special reason for GetBackIndex returning 1?
How do I send controls to back? Given that my form has a lot of controls and sending everything but needed controls to front with BringToFront would be undesireable.