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:
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;
begin
Result := 1;
end;
should not it be 0?
Questions:
BringToFront
would be undesireable.Since I'm creating own controls,
ctrl := TSomeControl.Create(aForm);
ctrl.Parent := aForm;
ctrl.SendToBack;
can be replaced with:
ctrl := TSomeControl.Create(aForm);
aForm.InsertObject(0 {desired index}, ctrl);