Duplicating forms

skipper

Member
Licensed User
Hello all,

I know it is a very basic question but I'm having problems in duplicating forms. What I'm trying to achive is the following.

I have a single form application with lot of panels. To cleanup the design, I would like to duplicate the base form, changing the form name, in order to delete all unnecessary objects and leave only the single panel. Then, by code and when necessary, I'll move the panel from a form the the main one.

So, from
frmMain (with Panel1, Panel2, Panel3,....)

I would like to obtain

frmMain (with Panel1)
Form2 (with Panel2)
Form3 (with Panel3)

and so on...

I'm getting crazy in copying/moving forms between modules. Is anyone there so kind to describe the procedure step by step?

Many thanks
Skipper
 

klaus

Expert
Licensed User
Longtime User
What you can do is to modify the formname of the panels in a text editor.
Following example:
TestForm.sbp one form with 3 panels and 2 empty forms:
Version=6.80
NumberOfForms=3
Form1=frmMain
Form2=Form2
Form3=Form3
FormWidth=238
FormHeight=268
IconFile=
NumberOfDesktopIncludes=0
NumberOfDeviceIncludes=0
NumberOfObjects=0
NumberOfModules=0
Sub designer
addform(frmMain,"Form1","",220,220,220)@
addpanel(frmmain,Panel3,70,115,80,80,255,255,255,True,True)@
addpanel(frmmain,Panel2,135,25,80,80,255,255,255,True,True)@
addpanel(frmmain,Panel1,40,20,80,80,255,255,255,True,True)@
addform(Form2,"Form2","",220,220,220)@
addform(Form3,"Form3","",220,220,220)@
End Sub
@EndOfDesignText@
Sub Globals
'Declare the global variables here.
End Sub
Sub App_Start
frmMain.Show
End Sub

TestFormNew.sbp modified in a text editor, Pane2 on Form2 and Panel3 on Form3 :
Version=6.80
NumberOfForms=3
Form1=frmMain
Form2=Form2
Form3=Form3
FormWidth=238
FormHeight=268
IconFile=
NumberOfDesktopIncludes=0
NumberOfDeviceIncludes=0
NumberOfObjects=0
NumberOfModules=0
Sub designer
addform(frmMain,"Form1","",220,220,220)@
addpanel(frmmain,Panel1,40,20,80,80,255,255,255,True,True)@
addform(Form2,"Form2","",220,220,220)@
addpanel(form2,Panel2,135,25,80,80,255,255,255,True,True)@
addform(Form3,"Form3","",220,220,220)@
addpanel(form3,Panel3,70,115,80,80,255,255,255,True,True)@
End Sub
@EndOfDesignText@
Sub Globals
'Declare the global variables here.
End Sub
Sub App_Start
frmMain.Show
End Sub

Be careful to move the lines with the panels after the form definition line.

!!! Make a copy of the original file before modifying, in case of !!!

Best regards.
 

skipper

Member
Licensed User
Hi Klaus,

thank you for the tips. It should be a very quick solution.

In the meantime, I understood what was my mistake when adding a module. I forgot to rename the main module... now it works also from the designer.

But I'll try your solution, it seems quick (renaming also the "parent" of objects embedded into the panel) :)

Thanks again
Mimmo
 
Top