arilotta Posted March 1, 2019 Share Posted March 1, 2019 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 More sharing options...
Sherzod Posted March 2, 2019 Share Posted March 2, 2019 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; 3 Link to comment Share on other sites More sharing options...
arilotta Posted March 12, 2019 Author Share Posted March 12, 2019 Thank you Sherzod, it works. 1 Link to comment Share on other sites More sharing options...
freedowsRoO Posted March 18, 2019 Share Posted March 18, 2019 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 More sharing options...
Sherzod Posted March 18, 2019 Share Posted March 18, 2019 9 minutes ago, freedowsRoO said: Can i get this 'indexToMove' in runtime? Sorry, what do you mean? Please explain. Link to comment Share on other sites More sharing options...
freedowsRoO Posted March 18, 2019 Share Posted March 18, 2019 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 More sharing options...
freedowsRoO Posted March 18, 2019 Share Posted March 18, 2019 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 More sharing options...
Sherzod Posted March 18, 2019 Share Posted March 18, 2019 Sorry, do you have a simple testcase for drag&drop? Link to comment Share on other sites More sharing options...
freedowsRoO Posted March 18, 2019 Share Posted March 18, 2019 2 hours ago, Sherzod said: Sorry, do you have a simple testcase for drag&drop? Yes, here is it. In example the panel always move to the first position (index 0), i need that the panel move to the position of the panel that i need to drop. Drag&Drop.rar Link to comment Share on other sites More sharing options...
freedowsRoO Posted March 19, 2019 Share Posted March 19, 2019 Hellooo! Any solution? Link to comment Share on other sites More sharing options...
Sherzod Posted March 19, 2019 Share Posted March 19, 2019 Hello, Let me check 1 Link to comment Share on other sites More sharing options...
freedowsRoO Posted March 20, 2019 Share Posted March 20, 2019 22 hours ago, Sherzod said: Hello, Let me check if can help you i can do this in a VCL application using the following code: var ctrl : TWinControl; begin ctrl := FindVCLWindow(Mouse.CursorPos); Link to comment Share on other sites More sharing options...
newsanti Posted February 26, 2023 Share Posted February 26, 2023 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 More sharing options...
Sherzod Posted February 26, 2023 Share Posted February 26, 2023 1 hour ago, newsanti said: How to use Index of TuniFrame? ? Link to comment Share on other sites More sharing options...
newsanti Posted February 26, 2023 Share Posted February 26, 2023 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 More sharing options...
Sherzod Posted February 26, 2023 Share Posted February 26, 2023 1 minute ago, newsanti said: Form (Container) - Frame1 (Index1) - Frame2 (Index2) - Frame3 (Index3) Make a simple testcase if possible. I will try to check. Link to comment Share on other sites More sharing options...
newsanti Posted March 16 Share Posted March 16 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 More sharing options...
newsanti Posted March 17 Share Posted March 17 On 2/26/2023 at 9:20 PM, Sherzod said: Make a simple testcase if possible. I will try to check. Mobile Layout.zip Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now