Detect when Pharo loses focus

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Detect when Pharo loses focus

roberto.minelli@usi.ch
Hi guys,

I am trying to detect when a user switches her focus from Pharo to another app.

In short I’d like to know when the user switches (i.e., atl+tab) from the Pharo application to another application, losing focus from the development.

I looked into Morphic and I was able to tell when the mouse goes outside the Pharo window.
Unfortunately this technique does not work when the user uses alt+tab to switch to another app, since the last mouse event is not outside the Pharo window.

Any suggestion where to look?

Thanks in advance,
R
Reply | Threaded
Open this post in threaded view
|

Re: Detect when Pharo loses focus

Benjamin Van Ryseghem (Pharo)
Did World trigger a keyboard focus lost announcement?

Ben

On 13 Jan 2014, at 06:49, [hidden email] wrote:

Hi guys,

I am trying to detect when a user switches her focus from Pharo to another app.

In short I’d like to know when the user switches (i.e., atl+tab) from the Pharo application to another application, losing focus from the development.

I looked into Morphic and I was able to tell when the mouse goes outside the Pharo window.
Unfortunately this technique does not work when the user uses alt+tab to switch to another app, since the last mouse event is not outside the Pharo window.

Any suggestion where to look?

Thanks in advance,
R

Reply | Threaded
Open this post in threaded view
|

Re: Detect when Pharo loses focus

roberto.minelli@usi.ch
I wasn’t able to find something like that.

There is MorphLostFocus, bit is not triggered by World. And not triggered when Pharo loose focus.

Cheers,
R

On Jan 13, 2014, at 12:00 PM, Benjamin <[hidden email]> wrote:

> Did World trigger a keyboard focus lost announcement?
>
> Ben
>
> On 13 Jan 2014, at 06:49, [hidden email] wrote:
>
>> Hi guys,
>>
>> I am trying to detect when a user switches her focus from Pharo to another app.
>>
>> In short I’d like to know when the user switches (i.e., atl+tab) from the Pharo application to another application, losing focus from the development.
>>
>> I looked into Morphic and I was able to tell when the mouse goes outside the Pharo window.
>> Unfortunately this technique does not work when the user uses alt+tab to switch to another app, since the last mouse event is not outside the Pharo window.
>>
>> Any suggestion where to look?
>>
>> Thanks in advance,
>> R
>


Reply | Threaded
Open this post in threaded view
|

Re: Detect when Pharo loses focus

Torsten Bergmann
That is not supported by default (at least not on Win). Since you switch to another window/process
usually this should not be intercepted/prevented by an application.

But it is doable using a hook:
http://stackoverflow.com/questions/1161053/capturing-keystrokes-without-focus
http://stackoverflow.com/questions/1346689/how-do-i-trap-windows-key-alttab-ctrlaltdelete-in-c

Bye
T.

> Gesendet: Montag, 13. Januar 2014 um 12:50 Uhr
> Von: "[hidden email]" <[hidden email]>
> An: Pharo-dev <[hidden email]>
> Betreff: Re: [Pharo-dev] Detect when Pharo loses focus
>
> I wasn’t able to find something like that.
>
> There is MorphLostFocus, bit is not triggered by World. And not triggered when Pharo loose focus.
>
> Cheers,
> R
>
> On Jan 13, 2014, at 12:00 PM, Benjamin <[hidden email]> wrote:
>
> > Did World trigger a keyboard focus lost announcement?
> >
> > Ben
> >
> > On 13 Jan 2014, at 06:49, [hidden email] wrote:
> >
> >> Hi guys,
> >>
> >> I am trying to detect when a user switches her focus from Pharo to another app.
> >>
> >> In short I’d like to know when the user switches (i.e., atl+tab) from the Pharo application to another application, losing focus from the development.
> >>
> >> I looked into Morphic and I was able to tell when the mouse goes outside the Pharo window.
> >> Unfortunately this technique does not work when the user uses alt+tab to switch to another app, since the last mouse event is not outside the Pharo window.
> >>
> >> Any suggestion where to look?
> >>
> >> Thanks in advance,
> >> R
> >
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Detect when Pharo loses focus

Igor Stasenko
In reply to this post by roberto.minelli@usi.ch



On 13 January 2014 10:49, [hidden email] <[hidden email]> wrote:
Hi guys,

I am trying to detect when a user switches her focus from Pharo to another app.

In short I’d like to know when the user switches (i.e., atl+tab) from the Pharo application to another application, losing focus from the development.

I looked into Morphic and I was able to tell when the mouse goes outside the Pharo window.
Unfortunately this technique does not work when the user uses alt+tab to switch to another app, since the last mouse event is not outside the Pharo window.

Any suggestion where to look?

 
FYI: Right now we're working with Ronie to replace that in VM, so you can handle this kind of events from image.

 
Thanks in advance,
R


--
Best regards,
Igor Stasenko.
Reply | Threaded
Open this post in threaded view
|

Re: Detect when Pharo loses focus

roberto.minelli@usi.ch
Thanks Igor,

Could u please ping me when you manage to have this doable from the image? Thanks in advance!

Cheers,
R

On Jan 13, 2014, at 7:40 PM, Igor Stasenko <[hidden email]> wrote:

>
>
>
> On 13 January 2014 10:49, [hidden email] <[hidden email]> wrote:
> Hi guys,
>
> I am trying to detect when a user switches her focus from Pharo to another app.
>
> In short I’d like to know when the user switches (i.e., atl+tab) from the Pharo application to another application, losing focus from the development.
>
> I looked into Morphic and I was able to tell when the mouse goes outside the Pharo window.
> Unfortunately this technique does not work when the user uses alt+tab to switch to another app, since the last mouse event is not outside the Pharo window.
>
> Any suggestion where to look?
>
>  
> FYI: Right now we're working with Ronie to replace that in VM, so you can handle this kind of events from image.
>
>  
> Thanks in advance,
> R
>
>
> --
> Best regards,
> Igor Stasenko.