Lisp HUG Maillist Archive

When application loses focus

Hi,

I would like to run certain functions when my CAPI application loses focus to another application. On Cocoa, this is easy enough: I just specify :activate-callback when I create the cocoa-default-application-interface. On Windows however, I can't figure out how to do it.

The WM_ACTIVATEAPP message is what I want to catch, but is sent to the application's WindowProc function. Is it possible to hook into that via CAPI?

Using activate-callbacks of individual CAPI interfaces doesn't work well, since when an activation callback is called, there is no way to tell where it is loosing focus *to*.

Any ideas?

Erik



_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: When application loses focus

On Thu, Jul 24, 2014 at 8:51 PM, Erik Ronström
<erik.ronstrom@doremir.com> wrote:
> The WM_ACTIVATEAPP message is what I want to catch, but is sent to the application's WindowProc function. Is it possible to hook into that via CAPI?

The techniques described here might work:

  http://permalink.gmane.org/gmane.lisp.lispworks.general/10453

Cheers,
Edi.

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: When application loses focus

Erik Ronström wrote on Thu, 24 Jul 2014 20:51:04 +0200 22:51:

| Using activate-callbacks of individual CAPI interfaces doesn't work
| well, since when an activation callback is called, there is no way to
| tell where it is loosing focus *to*.
|
| Any ideas?

My idea is to schedule a global timer on deactivating, i.e. calling the
activate-callback with NIL as the second argument. After a "certain"
time interval, you can decide that the user is "really" deactivating you
application.

The timer is unscheduled on activating any of the interfaces of your
application.

This technique is not one hundred percent workable but is quite
satisfactory.
(It is used in YstokWidgets Professional Edition to control interaction
between master and slave windows. The difference is that the timer is not
global but is kept in a local slot of the slave-interface instance.)
--
Sincerely,
Dmitry Ivanov
lisp.ystok.ru

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Updated at: 2020-12-10 08:33 UTC