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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...