You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Duto <ol...@pasteur.fr> on 2010/08/18 12:29:08 UTC

click event outside Sheet (modal window) ?

Hello,

When I have Sheet (modal window) display, is there a possiblility to capture
the click event outside the Sheet because I would like to close the Sheet
when the user click outside the model form ?

Best regards.

Duto
-- 
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/click-event-outside-Sheet-modal-window-tp1203168p1203168.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: click event outside Sheet (modal window) ?

Posted by Greg Brown <gk...@mac.com>.
This will work, but may produce an undesired side effect. TerraSheetSkin beeps when the user clicks over the owner's client area. Since TerraSheetSkin will probably register its container mouse listener first, it will get the event first and the system will beep before your handler (which closes the window) will be called.

Not sure there is a good way to do this at the moment.

On Aug 18, 2010, at 7:50 AM, Chris Bartlett wrote:

> I just took a quick look at the TerraSheetSkin source, and now see what is happening behind the scenes.
> A ContainerMouseListener is added to the Display to handle mouse events (when the sheet is opened).  
> You should be able to do the same thing and close the sheet depending on where the x & y coordinates are.
> 
> That is much tidier than invisible windows :)
> 
> Chris
> 
> 
> On 18 August 2010 18:34, Chris Bartlett <cb...@gmail.com> wrote:
> A Pivot Sheet is always modal, so only captures mouse clicks within its bounds.
> http://pivot.apache.org/tutorials/windows.html
> 
> If you use a Frame or Dialog (either standard Pivot ones, or your own custom version), you will be able to capture mouse clicks from outside of its bounds.
> A simple way to do this might be to first display a transparent window over the whole GUI, and set a mouse listener for it which would close the Frame/Dialog when you require.
> Then you could open your Frame/Dialog using the transparent window as the parent.
> 
> There are probably other cleaner ways of doing this.
> 
> Regards,
> 
> Chris
> 
> On 18 August 2010 17:29, Duto <ol...@pasteur.fr> wrote:
> 
> Hello,
> 
> When I have Sheet (modal window) display, is there a possiblility to capture
> the click event outside the Sheet because I would like to close the Sheet
> when the user click outside the model form ?
> 
> Best regards.
> 
> Duto
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/click-event-outside-Sheet-modal-window-tp1203168p1203168.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
> 
> 


Re: click event outside Sheet (modal window) ?

Posted by Chris Bartlett <cb...@gmail.com>.
I just took a quick look at the TerraSheetSkin source, and now see what is
happening behind the scenes.
A ContainerMouseListener is added to the Display to handle mouse events
(when the sheet is opened).
You should be able to do the same thing and close the sheet depending on
where the x & y coordinates are.

That is much tidier than invisible windows :)

Chris


On 18 August 2010 18:34, Chris Bartlett <cb...@gmail.com> wrote:

> A Pivot Sheet is always modal, so only captures mouse clicks within its
> bounds.
> http://pivot.apache.org/tutorials/windows.html
>
> If you use a Frame or Dialog (either standard Pivot ones, or your own
> custom version), you will be able to capture mouse clicks from outside of
> its bounds.
> A simple way to do this might be to first display a transparent window over
> the whole GUI, and set a mouse listener for it which would close the
> Frame/Dialog when you require.
> Then you could open your Frame/Dialog using the transparent window as the
> parent.
>
> There are probably other cleaner ways of doing this.
>
> Regards,
>
> Chris
>
> On 18 August 2010 17:29, Duto <ol...@pasteur.fr> wrote:
>
>>
>> Hello,
>>
>> When I have Sheet (modal window) display, is there a possiblility to
>> capture
>> the click event outside the Sheet because I would like to close the Sheet
>> when the user click outside the model form ?
>>
>> Best regards.
>>
>> Duto
>> --
>> View this message in context:
>> http://apache-pivot-users.399431.n3.nabble.com/click-event-outside-Sheet-modal-window-tp1203168p1203168.html
>> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
>>
>
>

Re: click event outside Sheet (modal window) ?

Posted by Chris Bartlett <cb...@gmail.com>.
A Pivot Sheet is always modal, so only captures mouse clicks within its
bounds.
http://pivot.apache.org/tutorials/windows.html

If you use a Frame or Dialog (either standard Pivot ones, or your own custom
version), you will be able to capture mouse clicks from outside of its
bounds.
A simple way to do this might be to first display a transparent window over
the whole GUI, and set a mouse listener for it which would close the
Frame/Dialog when you require.
Then you could open your Frame/Dialog using the transparent window as the
parent.

There are probably other cleaner ways of doing this.

Regards,

Chris

On 18 August 2010 17:29, Duto <ol...@pasteur.fr> wrote:

>
> Hello,
>
> When I have Sheet (modal window) display, is there a possiblility to
> capture
> the click event outside the Sheet because I would like to close the Sheet
> when the user click outside the model form ?
>
> Best regards.
>
> Duto
> --
> View this message in context:
> http://apache-pivot-users.399431.n3.nabble.com/click-event-outside-Sheet-modal-window-tp1203168p1203168.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
>