Can I use this.over or this.down for paint routine on panel?
-
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.
-
@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.
-
@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.