How to intercept a pointer pressed within a container?

69 views
Skip to first unread message

Eyal Muchtar

unread,
Oct 25, 2013, 11:39:53 AM10/25/13
to codenameone...@googlegroups.com
In my application I'm using Tabs. One of the tabs contains  a Label with an image as it's icon.
I need to intercept the x and y of the pointer.
When using:
f.addPointerPressedListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
int evX = evt.getX() - x;
int evY = evt.getY() - y;
Dialog.show("PointerPressed", "x= " + evX + " y= " + evY, "Ok", null);
}
});
and pressing on the Tabs, the Dialog displayed and the other tab's content remains hidden and the previous tab's content remains on screen.
How can I fix that?
Thanks,
Eyal.

Shai Almog

unread,
Oct 25, 2013, 12:46:12 PM10/25/13
to codenameone...@googlegroups.com
Other events in the queue such as the handling of the tab switch didn't have time to complete since you showed the Dialog which is blocking the current form.
Just wrap this block in callSerially which will deffer its execution to the next EDT cycle after the button click was processed.
Reply all
Reply to author
Forward
0 new messages