Mouseover text on button in template

I have a template that consists of a button and a label. The label is on top of the button and is also the same size as the button. The label is in lieu of using the button’s text property because I want a button template that can be resized while the text remains the same size. I am trying to implement the mouseover text for either the button or the label, but neither works how I would like. If I enable the mouseover text on the button it doesn’t ever appear, I am assuming this is because the button is behind the label in z-order. If I instead enable the mouseover on the label, then I can no longer click the button.
Any suggestions?
Thanks
Dan

You aren’t going to be able to do this. The top-most component that has a mouse event handler will get all mouse events. Clicks vs. movement are subtypes, not separate events. (This is at the level of Java Swing itself, not an Ignition behavior.) Your button will never get the click if any object above it has a tooltip.
Consider using Anchored layout in your template, with the button anchored to all sides. That may be the effect you’re looking for.

1 Like

You can always rethrow events. An example as follows.

from java.awt.event import MouseEvent
evt = MouseEvent(event.source.path.to.other.component,event.getID(),event.getWhen(),event.getModifiers(),event.x,event.y,event.clickCount,event.popupTrigger,event.button)
event.source.path.to.other.component.dispatchEvent(evt)

The only thing you need to do is change the path to the other component.

2 Likes

Thanks for the replies.
I was able to get the layout behavior I wanted using Relative mode, not maintain aspect ratio, and don’t scale fonts. My goal is to have a button inside a template, where the template instance can be resized without changing the font size.

But I will also keep your suggestion (KC) for future reference.

Thanks
Dan