on a certain event, I would like to redraw my GUI. To build up a gui I use:
vb = renoise.ViewBuilder()
.. fill with buttons etc..
How to destroy/remove this vb?
With again declaring vb in the same way, a second gui popups, but the old gui stays. Also vb = nil does not have any effect.
To remove all views with a single âremove_childâ call, add all your views into one âbigâ parent view. Like for example a row, column. Then you only need to remove this row or rack to get rid of everythingâŚ
Cie: Could you let us know what exactly you need/want to do? Its about recreating or updating the step sequencer GUI, isnât it? What do you want to do there? I think it makes more sense to find a solution for this special case, your tool.
Re: âViewBuilder: a view with the id âtrack_number1â was already registered to this viewbuilder instance.â
You can use as many âViewBuilderâ's you need or want. Even multiple ones per GUI, dialog. They only hold view IDs in a table, you can later on access and do the construction of views.
If you anyway have locals of your views, like here:
local track_number = vb:popup {
id = âtrack_numberââŚi
}
then you donât need an ID at all, and could collect, memorize the view object directly in a table.
But as said above: Let us know what exactly you need to do in your tool, and lets try to find a solution for exactly this problem instead.
Thank you Taktik for your will to help, it is really appreciated.
Sorry for the late reply, unfortunately I had the last weeks no time due to work.
Yes this question refers to the StepSequencer. What I would like to do in my GUI is to add/remove dynamically a row of steps (that represents a track), if the user adds/removes a track. So when the Sequencer Gui is visible, and the user removes a track or adds one, a new row of steps becomes visible or gets removed.
As there is no possibility to check which track-number exactly was removed (only in general, that the amount of tracks has changed is observable), I had the idea to remove all rows of steps from the gui, parse all tracks, and add for each track a row again. Unfortunately I use IDs for each row to adress them from anywhere within the application; and when recreating the rows (with the same IDs) there is an error not to use the same ID again. At this point I got stuck.
If the gui is closed completely after a new track is added/removed, and then reloaded through clicking on the menue entry, it works well. Unfortunately I do not know how to close and restart the gui with a lua command.
If you know a way how to solve this problem, it would be great. Thank you anyway for your effort and your help.
For a removed track you will get the following argument passed to your notifier: {
type = âremoveâ,
index = track_index which got removed
}
If the view builder IDs are then still in your way, then use a builder per track you are showing, or clear old IDs before assigning new ones:
vb.views[âsome_viewâ] = nil â then create new views with the same id and same view builder