Path: utzoo!attcan!uunet!tank!nic.MR.NET!hal!cwjcc!mailrus!cornell!vax5!u2dj From: u2dj@vax5.CIT.CORNELL.EDU Newsgroups: comp.sys.mac.hypercard Subject: Re: How can I get instance variables in buttons Message-ID: <17291@vax5.CIT.CORNELL.EDU> Date: 11 Nov 88 20:59:18 GMT References: <77053@sun.uucp> Sender: news@vax5.CIT.CORNELL.EDU Reply-To: u2dj@vax5.cit.cornell.edu (PUT YOUR NAME HERE) Distribution: comp Organization: Cornell Information Technologies, Ithaca NY Lines: 31 In article <77053@sun.uucp> DATJN@NEUVM1.Bitnet (Jakob Nielsen Tech Univ of Denmark) writes: >I would like to be able to associate values with buttons >(e.g. a list of when it has been clicked, a pointer to a special >card field which would be different for each button, a text string different >from the name, etc.). > You might try something like this: After making a card field named "scripts" (just to see it work) make a button with the following script: I have been clicked 3 times The last time was 12:22 PM on mouseUp get script of me add one to word 5 of first line of it put the time into word 5 of second line of it put empty into last word of second line of it -- erase extra 'XM' set script of me to it put script of me into cd fld "scripts" end mouseUp ---- end of script------ Note that the first two lines are simply comments and are ignored by hypercard's message passing, but you can use then for data. (of course, it can be more than 2 lines, and can even use commas for separating items) Also note that they don't need the "--" comment delimeter, which is only necassay within a handler. Objects higher up can access the script of the target to get at the data, read it, modify it, etc. Ron Beloin u2dj@vax5.ccs.cornell.edu or u2dj@crnlvax5.bitnet