Path: utzoo!attcan!uunet!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!apple!agate!darkstar!ssyx.ucsc.edu!sirkm From: sirkm@ssyx.ucsc.edu (Greg Anderson) Newsgroups: comp.sys.mac.hypercard Subject: Re: XCMD's cannot set global variables. Message-ID: <3821@darkstar.ucsc.edu> Date: 27 May 90 17:06:59 GMT References: <3707@darkstar.ucsc.edu> <1266@urbana.mcd.mot.com> Sender: usenet@darkstar.ucsc.edu Reply-To: sirkm@ssyx.ucsc.edu (Greg Anderson) Organization: UC Santa Cruz; Division of Social Sciences Lines: 21 In article <1266@urbana.mcd.mot.com> willcox@urbana.mcd.mot.com (David A Willcox) writes: >In article <3707@darkstar.ucsc.edu> I write: >>I believe that the book "XCMD's for HyperCard" by Gary Bond mentions that >>XCMDs cannot create global variables. > >Am I missing something? I don't have any documentation available here >at work, but I could swear that there are a pair of callbacks called >something like GetGlobal() and SetGlobal() that let you get and set >globals from an XCMD. I've used them, and they work. Yes, GetGlobal and SetGlobal exist and work fine, but in my experience, strange things happen if the global variables do not exist before the XCMD tries to Get or Set them. (Strange things == the next XCMD that gets the variable finds it empty.) The best solution is to declare "Global foo" in some script that is always executed before the XCMD is invoked. ___\ /___ Greg Anderson ___\ /___ \ \ / / Social Sciences Computing \ \ / / \ /\/\ / University of California, Santa Cruz \ /\/\ / \/ \/ sirkm@ssyx.ucsc.edu \/ \/