Ok, now I've got the background.
I use this code to manage mouse events
actionListener=new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {

                if 
(isMouseEventOutside(evt.getX(),evt.getY())&&disposeOnMouseEventOutside) {
                evt.consume();
                latch.countDown();}
            }
        };
        
backgroundInteractionDialog.addPointerDraggedListener(actionListener);
        
backgroundInteractionDialog.addPointerPressedListener(actionListener);
        
backgroundInteractionDialog.addPointerReleasedListener(actionListener);
        backgroundInteractionDialog.addLongPressListener(actionListener);

but only the dragged event triggers the actionPerformed method. If I click 
or long-press nothing happens.
How to fix this?
Thanks regards

Il giorno domenica 3 gennaio 2021 alle 03:27:58 UTC+1 Shai Almog ha scritto:

> Use show(0, 0, 0, 0) to create a full screen interaction dialog. Not 
> showPopup.
>
> On Sunday, January 3, 2021 at 12:41:05 AM UTC+2 [email protected] wrote:
>
>> In the AnimatedDialog class that I shared resize should take pixels, but 
>> note that it's the margins, not the dimension
>>
>> On Sat, 2 Jan 2021, 15:53 'P5music' via CodenameOne Discussions, <
>> [email protected]> wrote:
>>
>>> Thanks
>>> I tried to use the resize method as it seems to be useful in my case. 
>>>
>>> backgroundInteractionDialog.resize(0,h,0,w); //w=2048 h=1534
>>> makes it disappear completely (w,h are the screen dimensions).
>>>
>>> instead
>>> backgroundInteractionDialog.resize(0,100,0,100);
>>> makes the backgroundInteractionDialog almost the size of the screen.
>>> It seems that the values are not in pixels (?).
>>>
>>> Regards
>>> Il giorno sabato 2 gennaio 2021 alle 16:07:20 UTC+1 [email protected] 
>>> ha scritto:
>>>
>>>> Hi P5,
>>>>
>>>> I took a similar path as yours some time ago. Instead of extending 
>>>> InteractionDialog, I created a separate class with similar functionality 
>>>> and tweaked part of its code. I recall that extending it wasn't working.
>>>>
>>>> I am sending you my version of it, perhaps you will find it useful.. 
>>>> Sample usage:
>>>>
>>>> Form f = getCurrentForm();
>>>> AnimatedDialog newDlg = new AnimatedDialog();
>>>> newDlg.setLayout(new BorderLayout());
>>>> Label titleLable = new Label("some title");
>>>>         titleLable.getAllStyles().setAlignment(Component.CENTER);
>>>>         Container myTitle = new Container(new BorderLayout());
>>>>         Border lineBorder = Border.createLineBorder(2, 0x33b5e5);
>>>>         Border emptyBorder = Border.createEmpty();
>>>>         Border newBorder = Border.createCompoundBorder(emptyBorder, 
>>>> lineBorder, emptyBorder, emptyBorder);
>>>>         myTitle.getAllStyles().setBorder(newBorder);
>>>>         myTitle.add(BorderLayout.CENTER, titleLable);
>>>>         newDlg.add(BorderLayout.NORTH, myTitle);
>>>> Button okBtn = new Button("OK");
>>>>         okBtn.getUnselectedStyle().setAlignment(4);
>>>>         okBtn.addActionListener(e -> {
>>>>             newDlg.disposeToTheTop();
>>>>         });
>>>>         FlowLayout centerLayout = new FlowLayout();
>>>>         centerLayout.setValign(CENTER);
>>>>         Container boxCenter = new Container(centerLayout);
>>>>         SpanLabel msgLbl = new SpanLabel("some msg");
>>>>         boxCenter.add(msgLbl);
>>>>         newDlg.add(CENTER, boxCenter);
>>>>         newDlg.add(BorderLayout.SOUTH, okBtn);
>>>>         int msgHeight = boxCenter.getPreferredH();
>>>>         int height = newDlg.getPreferredH();
>>>>         int width = newDlg.getPreferredW();
>>>>         int sideMargins = (f.getWidth() - width - 30) / 2;
>>>>         int verticalMargin = (f.getHeight() - height - 
>>>> f.getToolbar().getHeight()) /2;
>>>>         newDlg.setDisposeWhenPointerOutOfBounds(true);
>>>>         newDlg.setAnimationSync(true);
>>>>         newDlg.show(verticalMargin/2, verticalMargin + 
>>>> verticalMargin/2, sideMargins, sideMargins);
>>>>         int newMsgHeight = boxCenter.getPreferredH();
>>>>         if(newMsgHeight != msgHeight)
>>>>         {
>>>>             int newHeight = (newMsgHeight - msgHeight) + height;
>>>>             int newVerticalMargin = (f.getHeight() - newHeight - 
>>>> f.getToolbar().getHeight()) /2;
>>>>             newDlg.resize(verticalMargin/2, verticalMargin/2 + 
>>>> (newVerticalMargin - (verticalMargin - newVerticalMargin)), sideMargins, 
>>>> sideMargins, false);
>>>>         }
>>>>
>>>>
>>>>
>>>> On Mon, 28 Dec 2020 at 09:22, 'P5music' via CodenameOne Discussions <
>>>> [email protected]> 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/dc0981af-019d-4433-8658-f8b39d326f3dn%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/codenameone-discussions/dc0981af-019d-4433-8658-f8b39d326f3dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> -- 
>>> 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/46dda134-a710-443b-9f6e-6d4ee42894d4n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/codenameone-discussions/46dda134-a710-443b-9f6e-6d4ee42894d4n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
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/30a621f0-4381-4d2c-831b-1ddf5860fd47n%40googlegroups.com.

Reply via email to