<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body><div style="font-family:Helvetica,Arial;font-size:13px; ; ">Hello,</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">I’m not sure to understand exactly your request, but I think you could use Form embedded, as like you don’t want to use, but adding Properties at the Form ‘Template’, so it will really easy to access to the various children inside.</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">To identify each Form embedded included into your main Form, add a Property for that, like IdForm for example.</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">Next you could use an Array of your embedded Form to manage all created Forms like:</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">1-  Design your Form themplate</div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">2-  Create an array to manage those Forms</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">For example if your Form template is name ‘MyFormTemplate'</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">Public MyArrayForm as  MyFormTemplate[]<br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">Public Sub Add_Form_Template()</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><span class="Apple-tab-span" style="white-space:pre">    </span>Dim fNewForm as MyFormTemplate</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><span class="Apple-tab-span" style="white-space:pre">  </span>If MyArrayForm = NULL then</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><span class="Apple-tab-span" style="white-space:pre">                </span>MyArrayForm = New MyFormTemplate[]</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><span class="Apple-tab-span" style="white-space:pre">  </span>End If</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><span class="Apple-tab-span" style="white-space:pre">    </span>fNewForm = New MyFormTemplate</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><span class="Apple-tab-span" style="white-space:pre">     </span>fNewForm.IdForm = « your id »</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><span class="Apple-tab-span" style="white-space:pre"> </span>MyArrayForm.Add(fNewForm)</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">End</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div> <div class="gmail_signature"><div style="font-family:helvetica,arial;font-size:13px"><br></div><div style="font-family:helvetica,arial;font-size:13px">Nota: this is just an example</div><div style="font-family:helvetica,arial;font-size:13px"><br></div><div style="font-family:helvetica,arial;font-size:13px">— </div><div style="font-family:helvetica,arial;font-size:13px">Olivier Cruilles</div><div style="font-family:helvetica,arial;font-size:13px"><br></div></div> <br><p class="airmail_on">Le 26 mars 2020 à 07:01:05, ub2@gmx.ch (<a href="mailto:ub2@gmx.ch">ub2@gmx.ch</a>) a écrit:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>Dear Gambas Cracks
<br>
<br>2nd try, 1st see below
<br>(Was user@lists.gambas-basic.org partially down yesterday ?)
<br>
<br>Best regards
<br>ub2
<br>
<br>
<br>-------- Weitergeleitete Nachricht --------
<br>Betreff: How to duplicate Controls with all its preferences at runtime
<br>Datum: Wed, 25 Mar 2020 10:21:48 +0100
<br>Von: ub2@gmx.ch <ub2@gmx.ch>
<br>An: user@lists.gambas-basic.org
<br>Kopie (CC): ub2@gmx.ch
<br>
<br>Dear Gambas Cracks
<br>
<br>
<br>I'm fiddling since 2 days, code explodes, and I'm sure there must be a
<br>better way ...
<br>
<br>
<br>I'd like to duplicate at runtime various Controls (different types!)
<br>with all it's preferences (Formatting, Pictures, etc).
<br>
<br>The situation:
<br>In a scrollview I have "a well prepared Master-Controls-line" like
<br>TglBtn_...._0 | Txta_....._0  | Txtlbl_..._0 | Pixcb_..._0 | ...
<br>
<br>In order to get new "Record-Lines" I'd like to duplicate all those
<br>Master-Controls them with the clumsy code partially shown in
<br>      Attachement 200325...
<br>and access the Controls later with:
<br>      $Ctrl$ = Me.Txtlbl_....._1
<br>      $Ctrl$ = Me.Txtlbl_....._2
<br>              ...
<br>
<br>I'd like to avoid SubForms like:
<br>     $NewUFrm$ = New UFrmXYZ($RecNr$, ..., ..., $Scrvw$)
<br>because access to those new Controls becomes more complicated:
<br>      $Txtlbl_...._0$ = UFrmXYZ(Me.Scrvw.Children[0]).Children[2]
<br>
<br>
<br>My Question:
<br>Is there a command like:
<br>    $Ctrl_New$ = NewWithPrefs Control($CtrlParent$)
<br>    $Ctrl_New$ = Duplicate Control($CtrlParent$)
<br>    ore similar
<br>
<br>Any ideas, links, keywords, etc would be highly appreciated.
<br>
<br>
<br>Thanks for Gambas and this very helpful community.
<br>Take care and stay healthy
<br>
<br>ub2
<br>
<br>
<br>
<br>
<br>----[ http://gambaswiki.org/wiki/doc/netiquette ]----
<br></div></div></span></blockquote></body></html>