[comp.sys.amiga] Finding the Active Window

jmpi@ur-tut.UUCP (Spike) (03/03/88)

Hello, Amigans!
  This is the first of potentially many programming questions.  I am beginning
work on a little program (which will eventually find its way to the Net :-) and
I need to be able to find the active window on a given screen.  I know that the
Screen structure maintains a linked list of windows, but are these sorted by
activation or creation?  I tend to think that they are sorted in order of cre-
ation, though I would happily be told otherwise.  
  If they are indeed sorted by creation order, how can I find out which one is
active?  Can I get all the windows on a screen to send my program ACTIVEWINDOW
messages?  Or should I just scan the window list looking for the one with the
WINDOWACTIVE flag set?
  Thanks in advance for any assistance.  I'm sure this is a trivial question
for all you Gurus out there ;-)

 John "Reality Is Optional" Pisello--University of Rochester Computing Center 
                                                                          ///
     ARPA:  jmpi%UR-TUT@SEISMO.ARPA                        Another Proud ///  
   BITNet:  jmpi_ss@UORDBV.BITNET                            Amiga User ///   
     UUCP:  jmpi@UR-TUT.UUCP                                        \\\///    
  US Mail:  P.O. Box 28858  River Station  Rochester, NY 14627       \XX/    

lel@wuphys.UUCP (Lyle E. Levine) (03/04/88)

In article <1086@ur-tut.UUCP> jmpi@ur-tut.UUCP (Spike) writes:
>active?  Can I get all the windows on a screen to send my program ACTIVEWINDOW
>messages?  Or should I just scan the window list looking for the one with the

There can only be one active window on the system at a time.  The
easiest way to find it is to look at IntuitionBase -> ActiveWindow.

I think it goes like this:

		lockbase = LockIBase(0);
		ActWind = IntuitionBase -> ActiveWindow;
		UnlockIBase(lockbase);

Oh yes,  use ULONG lockbase;
	     struct Window *ActWind;

Make sure to open the Intuition library first.

Hope this helps!

==========================================================================

PS   I have been reading this news group for almost 2 years now but
     was unable to post to it.  As of last week, this has hopefully
     changed.  Free At Last!  I would appreciate a couple replies
     to confirm this however...

				Thanks in Advance...


==========

IBM is a Division of Sirius Cybernetics Corporation:
"their fundamental design flaws are completely hidden by their
superficial design flaws."  
			- "So Long And Thanks For All The Fish"

Lyle Levine: Paths -> ihnp4!wuphys!lel
		      uunet!wucs!wuphys!lel