Path: utzoo!mnetor!uunet!steinmetz!sunlight!guilford From: guilford@sunlight.steinmetz (james d guilford) Newsgroups: comp.sys.amiga Subject: Re: String Gadgets resolved! Message-ID: <8274@steinmetz.steinmetz.UUCP> Date: 21 Dec 87 17:32:46 GMT References: <1958@cup.portal.com> <4731@well.UUCP> Sender: root@steinmetz.steinmetz.UUCP Reply-To: guilford@csv.rpi.edu (james d guilford) Organization: General Electric CRD, Schenectady, NY Lines: 39 In article <4731@well.UUCP> ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) writes: >In article <1958@cup.portal.com> Steve_A_Hales@cup.portal.com writes: >> I was opening a >>normal window, and then I wanted to activate a string gadget on it. >>Stuart Ferguson suggested that I use something like this: >> Delay(5L); >> ActivateGaget(... >> > This doesn't sound right to me. Window opening *should* be >synchronous i.e. the window is valid when OpenWindow() returns (at least >that's the assumption I've been working on). Therefore, ActivateGadget() >should be a valid operation right after OpenWindow(). > > Mackraz? Any ideas? > >_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ >Leo L. Schwab -- The Guy in The Cape ihnp4!ptsfa -\ > \_ -_ Recumbent Bikes: dual ---> !{well,unicom}!ewhac >O----^o The Only Way To Fly. hplabs / (pronounced "AE-wack") >"Work FOR? I don't work FOR anybody! I'm just having fun." -- The Doctor As far as I understand it, the window is "valid" after OpenWindow returns. It just may not be rendered yet. If you try drawing on it, everything works as one would expect. The problem lies in ActivateGadget. It is really fussy about when it will work. The conditions under which it will not work are very long (window not activated, user doing strange things with mouse, etc.). If you call it right after OpenWindow, then the window isn't rendered and it becomes a nop. The proper solution that I know of is to wait for some message from the system (I can't recall which off hand) that means the window is actually rendered, and then call ActivateGadget. I hacked this into vt100 rel2.6 and I've had no problems with it. It seems to me that this is much cleaner than putting an arbitrary delay into things. I would therefore say that the problem is in ActivateGadget, and not in OpenWindow. --JimG (guilford@csv.rpi.edu)