Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!rutgers!ucsd!hub!6600pete From: 6600pete@hub.UUCP Newsgroups: comp.sys.mac.programmer Subject: Re: Have you had problems with SetClikLoop? Message-ID: <3429@hub.UUCP> Date: 29 Dec 89 02:36:46 GMT References: <921@excelan.COM> Sender: news@hub.UUCP Lines: 47 From article <921@excelan.COM>, by mahboud@kinetics.com (Mahboud Zabetian): > Hi. Anybody out there ever try calling SetClikLoop twice consecutively for > different TEHandles? I am doing so and it seems that the second call also > changes the value of the clikLoop field of the first TE! Sound strange? Yes and no. Yes, it's strange that it happens. Dunno why they chose to do it this way. No, it's not strange in that I've seen it before. My own situation was that a TE application I was writing set a ClikLoop, but a TE DA also wanted to do it. Under a certain set of circumstances, the DA would try to call its clikLoop and die because by that time its clikLoop pointed into outer space. My solution was to SetClikLoop every time any of my TE windows became active. I also had to do some mucking with an (undocumented?) application global. I got this info from Michael Kahl, who apparently wrote a substantial portion of TE (if I read him correctly). Here's a code fragment in Pascal: [ PROCEDURE Activate ( ... ); ] [ VAR TEMagic : LONGINT; TEMagicPtr : ^LONGINT; ] FUNCTION A5: longint; INLINE $2E8D; [ BEGIN... ] TEMagicPtr := pointer(A5 + 20); TEMagic := TEMagicPtr^; SetClikLoop(@myClikLoop, TEHandle(WindowPeek(whichWindow)^.refCon)); TEClick(theEvent.where, BitAnd(theEvent.modifiers, shiftKey) <> 0, TEHandle(WindowPeek(whichWindow)^.refCon)); TEMagicPtr^ := TEMagic; [ ...END; ] --- I wager this would be a lot more elegant, not to mention easier, in C. ------------------------------------------------------------------------------ Pete Gontier | InterNet: 6600pete@ucsbuxa.ucsb.edu, BitNet: 6600pete@ucsbuxa Editor, Macker | Online Macintosh Programming Journal; mail for subscription Hire this kid | Mac, DOS, C, Pascal, asm, excellent communication skills