Jump to content

How to rearrange panel positions at runtime with uniAlignmentClient


arilotta

Recommended Posts

Hi, I need to exchange at runtime the order of some panels in a container whose layout is vbox or hbox.

Let's say that at design time there is a container with Layout=vbox, with two children panels: Panel1 and Panel2.

At runtime they are positioned based on their Top value at design time, so for example Panel1 before Panel2.

How is it possible to excange their order/position at runtime ? I need the possibility to move Panel2 before Panel1...

Thanks in advance.

Andrea

Link to comment
Share on other sites

On 3/1/2019 at 3:53 PM, arilotta said:

How is it possible to excange their order/position at runtime ? I need the possibility to move Panel2 before Panel1...

Hi,

Can you try this approach?:

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  needToMove: TUniPanel;
  indxToMove: Byte;
begin
  needToMove := UniPanel2;
  indxToMove := 0;

  UniContainerPanel1.RemoveControl(needToMove);
  UniContainerPanel1.JSInterface.JSCall('insert', [indxToMove, needToMove.JSControl]);
  needToMove.JSInterface.JSCall('show', []);
end;

 

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...
On 3/2/2019 at 11:56 AM, Sherzod said:

Hi,

Can you try this approach?:


procedure TMainForm.UniButton1Click(Sender: TObject);
var
  needToMove: TUniPanel;
  indxToMove: Byte;
begin
  needToMove := UniPanel2;
  indxToMove := 0;

  UniContainerPanel1.RemoveControl(needToMove);
  UniContainerPanel1.JSInterface.JSCall('insert', [indxToMove, needToMove.JSControl]);
  needToMove.JSInterface.JSCall('show', []);
end;

 

Can i get this 'indexToMove' in runtime?

Link to comment
Share on other sites

1 minute ago, Sherzod said:

Sorry, what do you mean? Please explain.

Yep, i want to do the same thing that original post but using the drag event. I need to identify the component when i drag the panel to change their position.

Link to comment
Share on other sites

My only problem is the routine is to find the index of the object under the mouse on "endDragEvnt", just it. 

 

procedure TMainForm.UniPanel4EndDrag(Sender: TUniControl; Left, Top: Integer);
var
  origem: TUniControl;
  indxToMove: Byte;
begin
  origem := Sender;
  indxToMove := 0;

  UniContainerPanel1.RemoveControl(origem);
  UniContainerPanel1.JSInterface.JSCall('insert', [indxToMove, origem.JSControl]);
  origem.JSInterface.JSCall('show', []);
end;

 

Link to comment
Share on other sites

  • 3 years later...
On 3/2/2019 at 10:56 PM, Sherzod said:

Hi,

Can you try this approach?:

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  needToMove: TUniPanel;
  indxToMove: Byte;
begin
  needToMove := UniPanel2;
  indxToMove := 0;

  UniContainerPanel1.RemoveControl(needToMove);
  UniContainerPanel1.JSInterface.JSCall('insert', [indxToMove, needToMove.JSControl]);
  needToMove.JSInterface.JSCall('show', []);
end;

 

How to use Index of TuniFrame?

 

Link to comment
Share on other sites

2 hours ago, Sherzod said:

?

Form (Container)
  - Frame1 (Index1)
  - Frame2 (Index2)
  - Frame3 (Index3)
--------------------
Frame no JSInterface...
 

UniContainerPanel1.RemoveControl(needToMove);
  UniContainerPanel1.JSInterface.JSCall('insert', [indxToMove, needToMove.JSControl]);
  needToMove.JSInterface.JSCall('show', []);
Link to comment
Share on other sites

  • 1 year later...
On 3/2/2019 at 10:56 PM, Sherzod said:

Hi,

Can you try this approach?:

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  needToMove: TUniPanel;
  indxToMove: Byte;
begin
  needToMove := UniPanel2;
  indxToMove := 0;

  UniContainerPanel1.RemoveControl(needToMove);
  UniContainerPanel1.JSInterface.JSCall('insert', [indxToMove, needToMove.JSControl]);
  needToMove.JSInterface.JSCall('show', []);
end;

 

How to reorder TuniFrame because frame without JSInterfece?

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...