App Designer - Duplicate/Clone/Copy Components
63 views (last 30 days)
I am trying to clone some of my components in my App Designer app. I found the copyobj function but it does not satisfy my needs or I am not applying it correctly.
One example of what I try to do:
- App is started, uitable with is generated in the first tab within a uitabgroup and filled with some data on startup. This table should be saved invisible now including every property (Data, Format, Callbacks, ...) to be used later, maybe even multiple times.
- User makes some changes to this table.
- User presses a button that creates a new tab. Now the saved table from step 1 (not in the state after step 2) should appear in the new tab.
I marked the parts bold where my problem is.
Right now, I have a small empty panel to which I copy the table in the first step using copyobj and then copy it from there in the third step. Of course that is very dirty and doesn't even work properly as most properties are lost on the way even if I use the 'legacy' argument of copyobj.
A alternative approach would be getting all properties of the table and setting them to a new to create uitable. But I have no clue on how to do that.
Sahithi Kanumarlapudi on 3 Jun 2020
You could modify the 'Parent' property of the table(say table1) to be 'tab2'. This will make the table to apper in tab2. You could do this using the below line of code
app.table1.Parent = app.tab2;
And assuming that by table being invisible, you mean that you do not want the user to view the table then you could set the 'Visible' property of the app to be 0 as following
app.table1.Visible = 0;
For more information on UITable properties, you could refer to the following links