Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!mailrus!cornell!uw-beaver!teknowledge-vaxc!jbrouill From: jbrouill@teknowledge-vaxc.ARPA (Luc Brouillet) Newsgroups: comp.sys.mac.hypercard Subject: Re: help with PopUpMenu? Also LSC 3.0 Summary: use mouseDown Message-ID: <24757@teknowledge-vaxc.ARPA> Date: 2 Sep 88 22:05:11 GMT References: <21146@tut.cis.ohio-state.edu> Reply-To: jbrouill@teknowledge-vaxc.UUCP (Jean-Luc Brouillet) Organization: Teknowledge, Inc., Palo Alto CA Lines: 69 In article <21146@tut.cis.ohio-state.edu> cml@diplodocus.cis.ohio-state.edu (Christopher Lott) writes: >can anyone please help me with the syntax for calling a popup from >a script? I have the PopUpXcmd in my stack, but all attempts at calling >it just return a '0' (zero). I use the PopUp XCMD defined in Gary Bond's "XCMD's for Hypercard". I was also experiencing the same problem. The error was using the mouseUp message. The PopUpMenuSelect() routine expect the mouse to be down when called. Here is my working code: Script for the lock field that contains the selection: on mouseDown popChoice("item1,(-,item2,item 3,item 4,item 5,item 6,item 7,item 8") end mouseDown Script for the stack: on popChoice l repeat with n = 1 to the number of items of l put item n of l & ";" after m end repeat put rect of the target into r put PopMenu(item 2 of r, item 1 of r, m) into v put item v of l into the target end popChoice There seems to be a typo at the bottom of p. 261 of Bond's book. It should read: selection = (long) PopUpMenuSelect (myMenuHandle, (offsetTop + cardWindowLoc.v), (offsetLeft + cardWindowLoc.h), 1); Finally, I found the following handy for writing Bond's XCMDs in LSC 3.0: pascal void main (XCmdBlockPtr); void doXCmd (XCmdBlockPtr); pascal void main (paramPtr) XCmdBlockPtr paramPtr; { asm { MOVE.L A4,-(SP) ; save the old A4 MOVE.L A0,A4 ;load the address of the code segment ; in memory } doXCmd (paramPtr); asm { MOVEA.L (SP)+,A4 ; restore A4 } } void doXCmd (paramPtr) XCmdBlockPtr paramPtr; { /* what would normally be in the main() routine. } Have fun! Jean-Luc internet: jbrouill@teknowledge-vaxc.arpa usenet: {hplabs|sun|ucbvax|decwrl|sri-unix}!jbrouill%teknowledge-vaxc.arpa USMail: Teknowledge Inc, 1850 Embarcadero Rd, POB 10119, Palo Alto, CA 94303