Forum
    • Categories
    • Register
    • Login

    getPopupMenuTarget

    Scheduled Pinned Locked Moved General Questions
    3 Posts 2 Posters 31 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.
    • ulrikU
      ulrik
      last edited by

      I can't find any information about this, what is the function and how to use it?

      Skärmavbild 2026-02-12 kl. 08.37.11.png

      Hise Develop branch
      MacOs 15.6.1, Xcode 16.2
      http://musikboden.se

      dannytaurusD 1 Reply Last reply Reply Quote 0
      • dannytaurusD
        dannytaurus @ulrik
        last edited by dannytaurus

        @ulrik I asked Claude/Cursor and it said it's an internal C++ function that doesn't have much use in HISE script. 🤷

        What it does behind the scenes:

        When you set up a popup menu on a component (using popupMenuItems and allowCallbacks = "Popup Menu Only"), the engine shows a popup menu on click and then fires your callback with two arguments:

        • argument[0] — the component (this is the return value of getPopupMenuTarget)
        • argument[1] — the selected menu index

        So the engine already calls getPopupMenuTarget for you internally and passes the result as the first argument to your callback. You never need to call it yourself.

        The practical scenario it supports:

        The main reason it exists is for ScriptDynamicContainer (the ScriptContainerComponent). In a dynamic container with child elements, if each child has a popup menu, you need to know which child was right-clicked. The override ensures your callback receives a reference to the specific child rather than the parent container. But again, this happens automatically — you just receive the correct reference in your callback.

        Why it's in the docs:

        It appears in the public API docs because HISE auto-generates documentation for all methods on script component classes, including internal/virtual ones. The description "Override this if you want to change the component parameter" is C++ language leaking through — you can't override virtual methods from HISEScript.

        TL;DR: You wouldn't call it in HISE script. It's an internal plumbing method. What you would use is the popup menu system itself — setting popupMenuItems, popupOnRightClick, and allowCallbacks on a Panel or Image, then handling the result in your mouse callback where the target component is already provided as the first argument.

        Meat Beats: https://meatbeats.com
        Klippr Video: https://klippr.video

        ulrikU 1 Reply Last reply Reply Quote 1
        • ulrikU
          ulrik @dannytaurus
          last edited by ulrik

          @dannytaurus said in getPopupMenuTarget:

          Thank you!

          Hise Develop branch
          MacOs 15.6.1, Xcode 16.2
          http://musikboden.se

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

          28

          Online

          2.2k

          Users

          13.4k

          Topics

          116.5k

          Posts