Path: utzoo!utgpu!water!watmath!clyde!rutgers!ames!oliveb!amiga!jimm
From: jimm@amiga.UUCP (Jim Mackraz)
Newsgroups: comp.sys.amiga
Subject: Re: String Gadgets resolved
Message-ID: <1972@amiga.amiga.UUCP>
Date: 16 Dec 87 19:42:41 GMT
Reply-To: jimm@amiga.UUCP (Jim Mackraz)
Organization: Commodore-Amiga Inc., 16795 Lark Ave. Suite 106, Los Gatos CA 95030
Lines: 40

::
Regarding string gadgets, and the use of ActivateGadget().

The lowdown is this here:

ActivateGadget() will fail if conditions are not IDEAL at the time
it is called.  This includes: the window for the gadget is active, it's
requester (if applic.) is active, menus aren't in use, other gadgets
not in use (I think), propgadget not in use, and so on.

OpenWindow() is synchronous; it won't return until the window is set up,
but if you set the ACTIVATE flag, the activation of the window
will not happen until Intuition has had a chance to run as the input.device,
since it is only then that it can handle activation changes (good reasons).

SO, OpenWindow() normally returns with the window INACTIVE.  Calling a 
Delay(5L) to let things sort out is kind of bad, especially since
a truer alternative is available (you could get screwed if there is
a lot of blitter activity, I think).  What you want to do is wait
until you get your first ACTIVEWINDOW message from Intuition, then
you have a good shot at getting the gadget active.

Clearly, there are lots of edge conditions (users banging on gadgets, 
IHelp, other programs opening windows, and so on) which might cause
ActivateGadget() to fail.  Be sure that you can handle this.  You
might change a message, or try to Activate it again after something
happens.  Watch the Workbench Rename gadget work as you click around.

Note that if you have a Requster string gadget, you need to be even
trickier, since you need to wait for both ACTIVEWINDOW and REQACTIVE.

And that's the lowdown.

	jimm

-- 
	Jim Mackraz, I and I Computing	  
	amiga!jimm	BIX:jmackraz
Opinions are my own.  Comments regarding the Amiga operating system, and
all others, are NOT to be taken as Commodore official policy.