HISE Logo Forum
    • Categories
    • Register
    • Login

    Set Popup value to show on hover.

    Scheduled Pinned Locked Moved Scripting
    4 Posts 3 Posters 279 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.
    • CyberGenC
      CyberGen
      last edited by

      Hi there!

      I'm looking for a way to set popup values to appear when the mouse hovers over the component, rather than only on click/drag.

      Preferably with a one-second delay, kind of like a tooltip.

      I tried using an if (event.hover) in the LAF, but it didn't work.

      Does anyone know how to do this?

      HISEnbergH A 2 Replies Last reply Reply Quote 0
      • HISEnbergH
        HISEnberg @CyberGen
        last edited by

        @CyberGen I don't have the exact code with me right now but I've previous used the text label to do something like this:

        if (obj.hover || obj.clicked) {
        labelText = obj.valueAsText;
        }
        
        1 Reply Last reply Reply Quote 1
        • A
          aaronventure @CyberGen
          last edited by

          @CyberGen create a timer object. if you're not using a panel, create one in its own variable. if you are, the panel already has one.

          your if (event.hover) should now save a variable that says hover = 1 and start the timer. give it a time of 100ms or so.

          if you're using the panel, do it inside the mouse callback. if not, create a mouse broadcaster that will do this and attach the components that you want to exhibit this behavior to the broadcaster. if you're using control helpers, you can call .attach.. for each control inside the function i.e. you don't have to pass all the controls to it within a single call.

          your timer should have pretty much a few lines:

          if (time since timer start > target time && hover == 0)
          {
          stopTimer()
          repaint component
          }

          you now query whether the timer is running to decide whether to show the label in your LAF/PR.

          there's a bunch of ways to approach this, but they all involve a timer. you can trigger the timer if event.hover == 0 so when the mouse leaves the component, it starts the timer, but you should now be querying both the timer and the hover variable you're setting.

          remember, the some event properties like event.clicked only fire when you click. event.hover will say true pretty much for every callback except when you move the mouse away.

          CyberGenC 1 Reply Last reply Reply Quote 1
          • CyberGenC
            CyberGen @aaronventure
            last edited by

            @aaronventure Oh this is perfect. Thank you very much for the detailed instruction. I'll dive into it and let you know how it goes.

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

            54

            Online

            1.7k

            Users

            11.7k

            Topics

            101.8k

            Posts