Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!travelers.mail.cornell.edu!news.kei.com!eff!news.duke.edu!agate!howland.reston.ans.net!newsfeed.internetmci.com!in1.uu.net!world!carlg
From: carlg@world.std.com (Carl E Gundel)
Subject: Re: How can ST know when it gets focus???
Message-ID: <DH21MB.8FB@world.std.com>
Organization: The World, Public Access Internet, Brookline, MA
X-Newsreader: TIN [version 1.2 PL2]
References: <DH1Er5.M5F@online.tmx.com.au>
Date: Thu, 26 Oct 1995 12:06:11 GMT
Lines: 33

FOOTPRINT@ wrote:
: How can I make my ST V/PM app be aware when it is the active/inactive task?  
: I have an application that co-exists on an OS/2 machine with other apps
: and whenever my app becomes the current task, it needs to know.
: I have come up with a solution that involves forking a continuous polling of Notifier>>haveFocus.  Surprisingly,
: there is no noticeable performance degradation(contrary to what my PMMEM program tells me), although the
: desktop and mouse behave a bit strangely.  I would prefer to use something else, possibly from 
: the OS, but browsing the library doesn't admit any obvious solutions.

In Visual ST 3.x, try sending the following in your application window's 
open method:

  aTopPane when: #activated send: #myMethodSelector to: myObject

add a similar line for the #deactivated event.

In VOS2 2.x this is less clear.  I didn't find an event for deactivation, 
and even adding #deactivate to the supportedEvents method for TopPane 
didn't have any effect, but for activation, try

  aTopPane when: #activate perform: #myMethodSelector:

In this case, when the window is activated, then aTopPane will be sent as 
an argument of #myMethodSelector: to aTopPane's owner.

Hope this helps.

Carl
-- 
------------------------------------------------------------------
Carl Gundel  carlg@world.std.com  Shoptalk Systems  508-872-5315
author of Liberty BASIC,  "EASY Windows and OS/2 programming!"
http://world.std.com/~carlg/basic.html
