HISE Logo Forum
    • Categories
    • Register
    • Login

    Customized Preset Item Table

    Scheduled Pinned Locked Moved General Questions
    8 Posts 3 Posters 1.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Evan C.E
      Evan C.
      last edited by Evan C.

      Hello, @Christoph-Hart!
      I am going to add some customized category lists which should be worked like preset systems.
      Is it possible to make such customized list columns like following with current HISE?

      0_1496905549094_upload-593942eb-3b52-4e98-8bda-ce7707b64059

      1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart
        last edited by

        I'll add a scriptable viewport then you can add a panel for each list item.

        1 Reply Last reply Reply Quote 1
        • LindonL
          Lindon
          last edited by

          • oh heaven.. Thanks.

          HISE Development for hire.
          www.channelrobot.com

          1 Reply Last reply Reply Quote 1
          • Christoph HartC
            Christoph Hart
            last edited by Christoph Hart

            Alright, I just added this feature to the master branch:

            Content.makeFrontInterface(600, 500);
            const var Viewport = Content.addViewport("Viewport", 27, 17);
            // [JSON Viewport]
            Content.setPropertiesFromJSON("Viewport", {
              "width": 174,
              "height": 150
            });
            // [/JSON Viewport]
            
            const var Panel = Content.addPanel("Panel", 0, 0);
            // [JSON Panel]
            Content.setPropertiesFromJSON("Panel", {
              "width": 155,
              "height": 540,
              "parentComponent": "Viewport",
              "allowCallbacks": "Clicks Only"
            });
            // [/JSON Panel]
            
            Panel.data.itemHeight = 30;
            
            Panel.setPaintRoutine(function(g)
            {
                var i = 0;
                
                for(item in this.data.itemList)
                {
                    g.setColour(Colours.white);
                    
                    g.drawText(item, [0, i * this.data.itemHeight + 10, this.getWidth(), 15]);
                    if(i == this.getValue())
                    {
                        g.setColour(Colours.withAlpha(Colours.white, 0.2));
                        g.fillRect([0, i * this.data.itemHeight, this.getWidth(), this.data.itemHeight]);
                        
                    }
                    
                    i += 1;
                }
            });
            
            inline function setItems(p, itemList)
            {
                p.data.itemList = itemList;
                
                p.set("height", itemList.length * p.data.itemHeight);
                p.repaint();
            }
            
            Panel.setMouseCallback(function(event)
            {
                if(event.clicked)
                {
                    var value = parseInt(event.y / this.data.itemHeight);
                    this.setValue(value);
                    this.changed();
                    this.repaint();
                }
                
            });
            
            const var items = ["Item 1", "Item 2", "Item 3","Item 4", "Item 5", "Item 6", 
                               "Item 1", "Item 2", "Item 3","Item 4", "Item 5", "Item 6", 
                               "Item 1", "Item 2", "Item 3","Item 4", "Item 5", "Item 6", ];
            
            setItems(Panel, items);
            
            1 Reply Last reply Reply Quote 0
            • Evan C.E
              Evan C.
              last edited by Evan C.

              Thanks, man!

              One more question, such viewport can be scrolled? And also if possible, can I customize such scroll bar with customized images or colors?

              1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart
                last edited by

                No problem, this was long overdue. For the original UX of a JUCE listbox I need to add a key stroke callback to the Panel, but this should get you going.

                1 Reply Last reply Reply Quote 0
                • Evan C.E
                  Evan C.
                  last edited by

                  One more question, such viewport can be scrolled? And also if possible, can I customize such scroll bar with customized images or colors?

                  1 Reply Last reply Reply Quote 0
                  • Christoph HartC
                    Christoph Hart
                    last edited by

                    It's the default JUCE scrollbar. You can set the colour of the thumb with the itemColour1 property.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post

                    44

                    Online

                    1.7k

                    Users

                    11.7k

                    Topics

                    101.9k

                    Posts