Forum
    • Categories
    • Register
    • Login

    Can I use this.over or this.down for paint routine on panel?

    Scheduled Pinned Locked Moved Scripting
    3 Posts 2 Posters 167 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.
    • VirtualVirginV
      VirtualVirgin
      last edited by

      When doing an LAF, you can use "obj.over", "obj.down" etc. to get the mouse state and change the appearance.

      Can I use "this.over", "this.down" etc. to do the same for a panel?
      I'm not getting any result from this Console.print():

      		    if(this.over)
      		    	Console.print("hover!");
      		    	g.setColour(this.itemColour2);  
      		        g.fillRoundedRectangle(ka, keyRound);
      		    
      		    
      		    if(this.down)
      		    	g.setColour(this.bgColour);
      		        g.fillRoundedRectangle(ka, keyRound);
      

      Just hoping I can do it this way without having to go use the mouseCallback explicitly for the panel.

      You can listen to my orchestral mockups here:
      https://www.virtualvirgin.net/
      I have a Git repo here:
      https://github.com/craig-van-hise

      David HealeyD 1 Reply Last reply Reply Quote 0
      • David HealeyD
        David Healey @VirtualVirgin
        last edited by David Healey

        @VirtualVirgin In the a panel's mouse callback you get a parameter, usually called event. This holds that information.

        https://docs.hise.dev/scripting/scripting-in-hise/scriptpanel.html#the-mouseevent-callback

        ...

        And I just re-read your question - you need to use a mouse callback, the panel is only repainted when you call the repaint function, so you can't dynamically get mouse information within it.

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        VirtualVirginV 1 Reply Last reply Reply Quote 0
        • VirtualVirginV
          VirtualVirgin @David Healey
          last edited by

          @d-healey said in Can I use this.over or this.down for paint routine on panel?:

          @VirtualVirgin In the a panel's mouse callback you get a parameter, usually called event. This holds that information.

          https://docs.hise.dev/scripting/scripting-in-hise/scriptpanel.html#the-mouseevent-callback

          ...

          And I just re-read your question - you need to use a mouse callback, the panel is only repainted when you call the repaint function, so you can't dynamically get mouse information within it.

          Thanks,
          that is generally the way I do it, but I was trying to transfer an LAF to a paint routine and was wondering if there was any trick to lower the workload of it that I didn't know of.

          You can listen to my orchestral mockups here:
          https://www.virtualvirgin.net/
          I have a Git repo here:
          https://github.com/craig-van-hise

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

          22

          Online

          2.1k

          Users

          13.0k

          Topics

          112.9k

          Posts