0
votes

I want to control the order of paint each of the control at the form.

I know that I can control it at the design move and it actually change creation order of controls at the form.

But is there way to change that at runtime?

1

1 Answers

1
votes

You'll probably find it depends on the order of the items in the parent objects Children list. There are various functions for managing the children of an object:

public
    //Returns the component we are a child of, which may not be the immediate parent
    function GetParentComponent: TComponent; override;
    function HasParent: Boolean; override;
    procedure AddObject(const AObject: TFmxObject);
    procedure InsertObject(Index: Integer; const AObject: TFmxObject);
    procedure RemoveObject(const AObject: TFmxObject); overload;
    procedure RemoveObject(Index: Integer); overload;
    function ContainsObject(AObject: TFmxObject): Boolean; virtual;
    procedure Exchange(const AObject1, AObject2: TFmxObject); virtual;
    procedure DeleteChildren;
    function IsChild(AObject: TFmxObject): Boolean; virtual;
    //Front and back (first and last) of Children list
    procedure BringToFront; virtual;
    procedure SendToBack; virtual;
    procedure AddObjectsToList(const AList: TFmxObjectList);
    procedure Sort(Compare: TFmxObjectSortCompare); virtual;
    property ChildrenCount: Integer read GetChildrenCount;
    property Children: TFmxChildrenList read FChildrenList;
    property Parent: TFmxObject read FParent write SetParent;
    //a.k.a. Parent.Children.IndexOf(Self)
    property Index: Integer read GetIndex write SetIndex;