[Gambas-user] How to duplicate Controls with all its preferences at runtime

ub2 at gmx.ch ub2 at gmx.ch
Wed Mar 25 10:21:48 CET 2020


Dear Gambas Cracks


I'm fiddling since 2 days, code explodes, and I'm sure there must be a
better way ...


I'd like to duplicate at runtime various Controls (different types!)
with all it's preferences (Formatting, Pictures, etc).

The situation:
In a scrollview I have "a well prepared Master-Controls-line" like
TglBtn_...._0 | Txta_....._0  | Txtlbl_..._0 | Pixcb_..._0 | ...

In order to get new "Record-Lines" I'd like to duplicate all those
Master-Controls them with the clumsy code partially shown in
	Attachement 200325...
and access the Controls later with:
	$Ctrl$ = Me.Txtlbl_....._1
	$Ctrl$ = Me.Txtlbl_....._2
		...

I'd like to avoid SubForms like:
     $NewUFrm$ = New UFrmXYZ($RecNr$, ..., ..., $Scrvw$)
because access to those new Controls becomes more complicated:
	$Txtlbl_...._0$ = UFrmXYZ(Me.Scrvw.Children[0]).Children[2]


My Question:
Is there a command like:
    $Ctrl_New$ = NewWithPrefs Control($CtrlParent$)
    $Ctrl_New$ = Duplicate Control($CtrlParent$)
    ore similar

Any ideas, links, keywords, etc would be highly appreciated.


Thanks for Gambas and this very helpful community.
Take care and stay healthy

ub2


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 200325-0950a_DuplCtrlsWIrhPrefs.png
Type: image/png
Size: 82549 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200325/5605e60f/attachment-0001.png>


More information about the User mailing list