HISE Logo Forum
    • Categories
    • Register
    • Login

    Script Panel Properties Related with Popup Menu

    Scheduled Pinned Locked Moved Scripting
    13 Posts 2 Posters 3.0k 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

      My HISE version is 0.99 and build version of it is 647.

      I think you can easily add the feature of separator, something like using "-" as the separator string in the string list.

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

        Are you using the most recent version on GitHub? I just added this feature a few days ago.

        And I'll add separators and deactivated items.
        I propose using ___ (three underscores) as separator string and ~~deactivated Item~~ for deactivated items (that's strikethrough in Markdown).

        I don't know if you need it but you can already make nested popup menus with the syntax SubMenu::Item

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

          Didn't read your last post. Let me know if you need a current build (also which OS you are working on).

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

            Yes, I knew how to add SubMenu as well. I found such codes in GitHub sources. And I am just using most recent version on GitHub and also HISE standalone as well.
            I prefer to know how to build HISE standalone with sources of GitHub repository.
            Otherwise, I will be appreciate if you provide me recent Win8.1 x64 and macOS Sierra builds.
            Thanks a lot.

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

              There are build instructions in the GitHub Readme

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

                Alright, I pushed these changes to GitHub. You can now do this:

                const var Panel = Content.addPanel("Panel", 55, 0);
                // [JSON Panel]
                Content.setPropertiesFromJSON("Panel", {
                  "width": 153,
                  "height": 30,
                  "allowCallbacks": "Context Menu",
                  "popupMenuItems": "**This is a header**\n___\nA\nB\n~~Not active~~\nC",
                  "popupOnRightClick": 0,
                  "popupMenuAlign": 1
                });
                // [/JSON Panel]
                

                I also added the section headers - just use the Markdown Syntax for **bold**. Be aware that Section Headers and Separators don't have an index (deactivated items still do).

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

                  This is a small helper function that deactivates items in a ScriptPanel:

                  /** Deactivates an item in a custom popup. */
                  inline function deactivatePopupItem(widget, index, isDeactivated)
                  {
                  	local list = widget.get("popupMenuItems").split("\n");
                  	if(isDeactivated)
                  	{
                  		if(list[index].indexOf("~~") != -1)
                  			return;
                  			
                  		list[index] = "~~" + list[index] + "~~";
                  	}
                  	else
                  	{
                  		list[index] = list[index].replace("~~", "");
                  	}
                  	
                  	widget.set("popupMenuItems", list.join("\n"));
                  }
                  
                  deactivatePopupItem(Panel, 1, true);
                  
                  1 Reply Last reply Reply Quote 0
                  • Evan C.E
                    Evan C.
                    last edited by Evan C.

                    Those are really nice and easy to implement. Now I made a nice popup menu by using above stuffs.
                    Many appreciate, Christoph!

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

                      I also added the section headers - just use the Markdown Syntax for **bold**. Be aware that Section Headers and Separators don't have an index (deactivated items still do).
                      

                      I have added Section Header with bold but it is having an index. Would you check and fix it?

                      0_1494642945191_upload-f5797e4c-24e7-4382-9cfc-eeeb74cac01a

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

                        Yeah I'll take a look.

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

                        33

                        Online

                        1.8k

                        Users

                        12.0k

                        Topics

                        104.6k

                        Posts