On Fri, 22 Apr 2005 20:32:06 -0400, Connor Wakamo <email@hidden>
said:
>Hello,
>
>I am still working on my choose-your-own-adventure game, and I want to
>determine which button was pressed. Right now, I use this code:
>
>on clicked theObject
> --Option 1
> if theObject is equal to button id 2 of window id 1 then
> display dialog "Option 1 was chosen"
> end if
>
> --Option 2
> if theObject is equal to button id 3 of window id 1 then
> display dialog "Option 2 was chosen"
> end if
>end clicked
>
>Right now, when the first button that I press first becomes gets
>handled as "Option 1" and the second button pressed becomes "Option 2".
> I don't want it to change from run to run depending on what the user
>does, I would like me to be able to say on the start screen "Press any
>button to continue..." Right now, I am working around this problem by
>forcing the user to press the button "Option 1". Any help will be
>greatly appreciated!
I don't understand why an object would change its id from run to run - I've
never seen that. However, there's is an easy solution. Assign the buttons a
tag (in Interface builder). This is the standard Cocoa way to give an object
an identifier. Of course alternatively you could just examine the button's
title instead of its id, but this is less elegant, since a title might
change in the course of development, and it might be localized. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden
This email sent to email@hidden