Page 1 of 1

Feature request : On mouse up

PostPosted: Wed May 04, 2011 9:07 am
by Peter de Groot
When a button that has an onAction method assigned, the onAction method is fired when the mouse button is released whilst the mouse pointer is over/on the button, some onMouseUp event I guess, but when a onAction is assigned to a label or image without the showClicked property checked the onAction method always get fired.

I would nice if an element on a window that has an onAction behaves the same as a button and only fires the method only when the mouse pointer is over/on the element and on a mouse up event.

Regards,

Peter

Re: Feature request : On mouse up

PostPosted: Wed May 04, 2011 10:26 am
by jcompagner
so if you have a label with an onaction then that is also done on mouse release, not on mouse press:

public void mouseReleased(MouseEvent e)
{
if (SwingUtilities.isLeftMouseButton(e) && isEnabled())
{
eventExecutor.fireActionCommand(true, AbstractScriptLabel.this, e.getModifiers(), e.getPoint());
}
}

So it should behave pretty much the same.

Re: Feature request : On mouse up

PostPosted: Wed May 04, 2011 11:04 am
by Peter de Groot
jcompagner wrote:so if you have a label with an onaction then that is also done on mouse release, not on mouse press:
So it should behave pretty much the same.


You're right, but only when the property showClick is checked √ , when it's not the onAction always fires when clicked.

Regards,
Peter

Re: Feature request : On mouse up

PostPosted: Wed May 04, 2011 11:22 am
by jcompagner
no a label with an onaction == showclick == false
And that onaction is only called on mouse release

Re: Feature request : On mouse up

PostPosted: Wed May 04, 2011 4:18 pm
by maurice
Hi,

I tested it also, and found out that onAction is always fired (showClick == false) even if you navigate away from the label and then release the mouse.
I would expect that if you navigate away from the label and then release the mouse it would not fire the onAction event.

Re: Feature request : On mouse up

PostPosted: Wed May 04, 2011 4:37 pm
by jcompagner
yes this is a difference between a label (with a onaction) and a button with an onaction
The mouseReleased is even triggered when the component is not again on that target
for a button this is the same thing but Swing (the java classes) has a special "armed" property and that is set to false when the mouse moves out of the component, and because of that it will not fire the action.

If you need this also for the label, place make a case , referring to this forum post.

Re: Feature request : On mouse up

PostPosted: Wed May 04, 2011 9:00 pm
by Harjo
+1
I have created a case: 382174

Re: Feature request : On mouse up

PostPosted: Thu May 05, 2011 9:05 am
by Peter de Groot
+1 Harjo

Re: Feature request : On mouse up

PostPosted: Thu May 05, 2011 10:42 am
by ROCLASI
+1

Re: Feature request : On mouse up

PostPosted: Thu May 05, 2011 11:20 am
by maurice
+1 :)