Please have a look to this code snippet. I added it to the CommandDialog:
private void setMouseEventsListener()
{
actionListener=new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
if (isMouseEventOutside(evt.getX(),evt.getY())) evt.consume();
}
};
form.addPointerDraggedListener(actionListener);
form.addPointerPressedListener(actionListener);
form.addPointerReleasedListener(actionListener);
form.addLongPressListener(actionListener);
}
It is not working as expected.
I can report this:
The layout is a table layout for a master/detail appearance.
In the left part there are some buttons and a large BrowserComponent.
In the right part there are some buttons and a small BrowserComponent.
Let's say a CommandDialog is called from the left container from a callback
of the Javascript interface of the BrowserComponent when I long press an
iFrame element.
The dialog appears.
-If I click inside the dialog, the mouse event is not processed. The dialog
buttons do not work. (not OK)
-If I click outside:
-if I click on the right container of the table layout nothing
happens (OK)
-if I click on the left container:
-if I click on a button the dialog disappear (OK
but I will have to handle the behaviour according to a parameter)
-if I click on the BrowserComponent the mouse
event reaches to it (not OK)
and
the dialog does not disappears (OK)
and
the click is processed and the right part
changes with the detail data (not OK).
What's the explanation and solution?
Thanks
Il giorno martedì 29 dicembre 2020 alle 04:08:07 UTC+1 Shai Almog ha
scritto:
> Hi,
> these methods are methods ofcomponent not form so they're designed for a
> component to grab events in a hierarchy. It appears in form because of its
> hierarchy.
> You can implement a pointer pressed/released/dragged listener and
> consume() all events that are out of bounds.
>
> On Monday, December 28, 2020 at 11:22:33 AM UTC+2 P5music wrote:
>
>> (Merry Christmas)
>>
>> My app now features a new dialog class, I called it CommandDialog. It
>> leverages both the features of InteractionDialog and Dialog, so the show()
>> method now returns a Command.
>> This class has to be completed to be fully functional:
>> I subclassed InteractionDialog so now I need to prevent the mouse events
>> from hitting the underlying components in the form.
>> I tried
>> form.setGrabsPointerEvents(false);
>> form.setIgnorePointerEvents(true);
>> but they seem not to be working at all. Furthermore they seem to be the
>> same instruction with negated boolean parameter.
>> Moreover I need the setDisposeWhenPointerOutOfBounds(value) feature that
>> also seem not to be working.
>>
>> I need a workaround if necessary. I have some ideas but maybe something
>> simple is available.
>>
>> This applies also to the InteractionDialog itself.
>>
>> Thanks in advance
>>
>>
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/07ac8b38-3e5e-421b-b134-ac95984d903dn%40googlegroups.com.