How to move a control from a form to a panel by selecting the correct location

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
cs_engineering
Posts: 10
Last visit: Mon Oct 31, 2022 7:12 am

How to move a control from a form to a panel by selecting the correct location

Post by cs_engineering »

Hi, I have set up a lot of controls directly on the windows form and now I need to create screens. Instead of using multiple forms, I want to use Panels. How do I point each of my controls (text boxes and buttons) to the new panel instead of the form directly using Powershell Studio GUI layout. When I copy paste, things break.

The code way would be something this and it is already being generated so I would prefer to configure this directly in the visual properties / controls

$Form.Control.Remove($button1)
$Panel.Control.Add($button1)
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: How to move a control from a form to a panel by selecting the correct location

Post by davidc »

To add a control within a panel in the designer, you simply need to drag the control into the panel. If the panel appears over the control, then right-click on the panel and select "Send To Back":
Send To Back.png
Send To Back.png (31.29 KiB) Viewed 4947 times
David
SAPIEN Technologies, Inc.
User avatar
cs_engineering
Posts: 10
Last visit: Mon Oct 31, 2022 7:12 am

Re: How to move a control from a form to a panel by selecting the correct location

Post by cs_engineering »

Hi David,

Thank you, however, this does not guarantee that the control is in the right place. I've been trying this as well as cut/paste and have been receiving back "spaghetti". I am looking for a way to point directly from a control and tell it that it is _now_ a child of another control (a panel in this case)

In the end I need to be left with 3 panels with a group of child objects so that when I do select a panel and send it back or front as you have illustrated, all the child object move with it.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: How to move a control from a form to a panel by selecting the correct location

Post by davidc »

Can you provide a screenshot as to what you are trying to accomplish?
David
SAPIEN Technologies, Inc.
User avatar
cs_engineering
Posts: 10
Last visit: Mon Oct 31, 2022 7:12 am

Re: How to move a control from a form to a panel by selecting the correct location

Post by cs_engineering »

The first screen (1.png) is controls on a separate panel that was built from start. The 2nd screen is the form with mixed controls that need to be separated into individual screens each on it's own panel.

I need to be able to set a property or something in the designer to accomplish this because if I do that in the code, it will redundant and not visible in the designer until after execution.
Attachments
2.PNG
2.PNG (9.92 KiB) Viewed 4914 times
1.PNG
1.PNG (10.14 KiB) Viewed 4914 times
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: How to move a control from a form to a panel by selecting the correct location

Post by davidc »

You are overlapping panels. No wonder you are running into issues :) I highly recommend using a TabControl instead:

https://info.sapien.com/index.php/guis/ ... tabcontrol
David
SAPIEN Technologies, Inc.
User avatar
cs_engineering
Posts: 10
Last visit: Mon Oct 31, 2022 7:12 am

Re: How to move a control from a form to a panel by selecting the correct location

Post by cs_engineering »

Thank you David,

I actually found a similar article today as well and have been trying to move the controls into Tabs as oppose to panels and I am still running into the same issue where I am forced to "copy/paste" the control and I am having trouble getting the control to "stick" to the tabpages. Hence I am still looking for a way to say somewhere in properties of the controls something like

ParentObject = tabpage1

To be able to force the Control association to tabpage and while building the form to be able to change TABS ion this case without leaving controls behind
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: How to move a control from a form to a panel by selecting the correct location

Post by davidc »

If you move the control within the panel, it should set the parent container automatically.
David
SAPIEN Technologies, Inc.
User avatar
cs_engineering
Posts: 10
Last visit: Mon Oct 31, 2022 7:12 am

Re: How to move a control from a form to a panel by selecting the correct location

Post by cs_engineering »

That's exactly what I have been reading. However there is no way to confirm that or force that and that is not what I am experiencing. Hence the reason I am looking for a way to set it explicitly.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: How to move a control from a form to a panel by selecting the correct location

Post by davidc »

Unfortunately, the designer has no explicit way of setting this. On our TODO list, is showing the controls in a tree structure for this very purpose, but I can't give you an ETA on that.
David
SAPIEN Technologies, Inc.
This topic is 5 years and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.