Most optimal way of managing panels with repeat controls?
I'm working on a project that has tabs in the GUI that flip between different tables. On each tab is a table, along with a bunch of controls of various ui types. Each tab is the exact same with everything in the exact same position -- just different iterations of the controls. There are roughly 50 ui elements on each tab that are tied to the respective table. My question is this: does it make more sense to actually re-declare these 50 elements for every single tab, or should I make integer arrays to store the values, and then reload them into the elements on a tab change? If I have, say, 8 tabs, thats 8*50 = 400 ui elements to declare, which really bloats the GUI. So instead, I was thinking something like this:
declare const NUM_TABS := 8 declare pers ui_value_edit ve1 declare pers %ve1_vals[NUM_TABS] declare pers ui_value_edit ve2 declare pers %ve2_vals[NUM_TABS] function tab_change ve1 := ve1_vals[selected_tab] ve2 := ve2_vals[selected_tab] end function on ui_control (ve1) ve1_vals[selected_tab] := ve1 end on on ui_control (ve2) ve2_vals[selected_tab] := ve2 end on
This is just a basic example showing 2 value edits shared by 8 tabs. Is this the most optimal way of handling this on a large scale? I just want to make sure I'm not overthinking this before commiting to writing the code this way. Thanks.
Just to be clear, I'm talking about custom tabs in the GUI -- not tabs from multiple scripts.
Comments
-
when i did something on a large scale i opted for storing values in an array and recalled the settings when viewing the tabs. the downside is you can't automate the ui because the control alters values in the context of what tab is viewed
2 -
In your particular case, I would use one widget and use an array to store the data, then update the widget value depending on which tab you're on. Much more compact. This works for pretty much anything, but if you need the parameter to be host automatable/MIDI learnable, this is where you need separate widget instances. For value edits and tables, though, you don't need that since those aren't automatable anyways.
1
Categories
- All Categories
- 19 Welcome
- 1.4K Hangout
- 60 NI News
- 731 Tech Talks
- 3.8K Native Access
- 15.8K Komplete
- 1.9K Komplete General
- 4.1K Komplete Kontrol
- 5.5K Kontakt
- 1.5K Reaktor
- 364 Battery 4
- 812 Guitar Rig & FX
- 416 Massive X & Synths
- 1.2K Other Software & Hardware
- 5.5K Maschine
- 6.9K Traktor
- 6.9K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators