Duplicating a panel within PagePanel

Hi, guys,

I am developing a program with a PagePanel that has 25 panels. Each panel has about 60 controls.

I want each panel to look identical in terms of the controls’ position on the panel.

Is there a way to duplicate a panel within a PagePanel? I am getting tired of aligning all the controls manually.

Thank you in advance,

Val

Create a ContainerControl, arrange your controls in there, and then put an instance of the container in each page of the page panel. Then the controls won’t change. Also If you make a change in the container, then all the pages will reflect that change.

Hi, Paul,

Thank you for the reply. I need to keep the layout the same but the function of the controls would be different depending on what panel in the PagePanel they are located.

I am not sure if a ContainerControl would be able to do it.

Thank you again,

Val

select the controls in the first panel, hit cmd-D (or ctrl-D on windows) to duplicate
move all the still selected duplicates OUTSIDE of the pagepanel, I move them to the bottom of the window, out of the window
change the panel to the second pane
move the controls of the bottom to the second pane
repeat to the other 24 panes …
but as Paul said, it is better to use containercontrols, as this multiple panels may get high lag times for the user after that.

You need to abstract your code from the controls and the pagepanels.

but do not complain Xojo IDE is slow

Overkill.
If the pages are genuinely the same, have one panel only.
Have the controls make use of methods that take a ‘style’ parameter

If you are displaying the panel as ‘panel1’ then have a property that records ‘I am currently a panel1 type’
You can even use this property to determine whether certain of the controls are visible.

Eg you have a panel for ‘animals’ that can be used to record things like height, color, and ‘egg color’
You would hide the ‘egg color’ control for animals of type mammal, for example

So, when people enter data, or save data, you can use
a select case, or
an overridden method,
or a method with a parameter to ‘do the right thing’

This is what Beatrix is referring to.

I usualy put one containercontrol on each page of the panel. You can easy do it on the open event of the pagepanel control.