2D array... What am I doing wrong?



  • I'm trying to create a 2D array to show/hide some controls, but it's not quite working yet.
    I've created an array of buttons that I'd like to use across multiple tabs of an interface. I've also created Arrays for each tab.
    Looks kinda like this:

    //Button Array
    const var ButtonArray = [       Content.getComponent("Button1"),
                                    Content.getComponent("Button2"),
                                    Content.getComponent("Button3")
                            ];
    
    //Tab Array
    const var Tab1 =        [       Content.getComponent("Picture1Background"),
                                    [ButtonArray]
                            ];
    
    const var Tab2 =        [       Content.getComponent("Picture2Background"),
                                    [ButtonArray]
                            ];
    

    I'm trying to use this on a page index where:
    Index 0 shows Picture 1 + button array
    Index 1 shows Picture 2 + same button array

    Any suggestions?



  • @dustbro Don't do it, no point. Just put all of your controls in panels and put the panels in an array (each panel takes the place of a 2D array's second dimension).



  • @d-healey Thanks!
    ok... stupid question. I've never used panels before and I don't see any documentation for them in the Interface Elements section. Is it as simple as creating a panel and dragging your components into it via the Widget list?



  • @dustbro Pretty much. You got my harp script? I use panels for almost every UI control including paging.



  • Couldn't get that to do what I needed either 😞
    I ended up making a separate page index for the buttons and calling that in my buttoncallback.
    That worked!



  • @dustbro Here's a full paging system that will work with any number of pages and it's only 31 lines including comments.

    HiseSnippet 1219.3ocsWs0aaaCElxIJsVadnEX+.HJ1C1Hco1YsYCHKnN14xL5RhvbZ2.JJBnknrIhLoAEUpMJBv9mr+J6mTGvdYOscnDkkThyEGfom7gmaemK7vickBOZTjPhrpd5rITj0WZ2eFWMp6HBii5sGx5w1tRZDUg5LaBIJh5irrV4PMWqpqhR997q6PBIbOZ9QHz6DLO5OyFyT4m519MrvvCH9zSYiKH8Ka2ySv6JBEw.RVwtIZBw6bxP5wDsXUrQVqsuOSIj8UDEMBjoiveV+QhOxSk+crH1fPplnEpOXnziQcGwB8cyhxHDxZU27XdkzX9qsOh4yleddr+jDF3bMJlCrpTFRqVBRstIHcfHzWafa.dVEf2pov6o188jrIpbNZr8E183JpLf.o8hvJUVTk+ZE6tBPBtZiwjyoGHAh4ZTeqlMeN9U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wqw8XXW9y77zIhuEP9h0XykViuao03kKsFuZo0XqkViueo03GtEMz+wociUhwoWKfCb2O4sQKq84DnqJoCD8e5FL6VC
    

Log in to reply
 

3
Online

315
Users

914
Topics

5.9k
Posts

Looks like your connection to Forum was lost, please wait while we try to reconnect.