epiCode Active Member Licensed User Nov 24, 2021 #1 If I duplicate a custom control in code as follows: B4X: Copy dim newcontrol1 as ccontrol newcontrol1 = existingccontrol1 It copies all the parameters and initializes the newcontrol1 Does it also attach the newcontrol1 to same parent as existingccontrol1 ?
If I duplicate a custom control in code as follows: B4X: Copy dim newcontrol1 as ccontrol newcontrol1 = existingccontrol1 It copies all the parameters and initializes the newcontrol1 Does it also attach the newcontrol1 to same parent as existingccontrol1 ?
Erel B4X founder Staff member Licensed User Longtime User Nov 24, 2021 #2 It doesn't do anything except of making the variable newcontrol1 point to the same object. Upvote 0
epiCode Active Member Licensed User Nov 24, 2021 #3 Erel said: It doesn't do anything except of making the variable newcontrol1 point to the same object. Click to expand... Is it possible to have another independent instance of it ? Upvote 0
Erel said: It doesn't do anything except of making the variable newcontrol1 point to the same object. Click to expand... Is it possible to have another independent instance of it ?
agraham Expert Licensed User Longtime User Nov 24, 2021 #4 mohsyn said: Is it possible to have another independent instance of it ? Click to expand... I'm not sure what you mean by an 'independent instance'. When you Dim an object you get a new instance of it. If you want a clone of an existing object then you will have to copy, and maybe deep copy, the salient properties to the new instance. Upvote 0
mohsyn said: Is it possible to have another independent instance of it ? Click to expand... I'm not sure what you mean by an 'independent instance'. When you Dim an object you get a new instance of it. If you want a clone of an existing object then you will have to copy, and maybe deep copy, the salient properties to the new instance.
Erel B4X founder Staff member Licensed User Longtime User Nov 24, 2021 #5 You cannot "duplicate" a control automatically. You can create a method in your class that extracts the existing properties and creates a new control based on these properties. It doesn't sound like you are going in the best route... Upvote 0
You cannot "duplicate" a control automatically. You can create a method in your class that extracts the existing properties and creates a new control based on these properties. It doesn't sound like you are going in the best route...