Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: How to pass a selected NSPopUpButton value to a variable



Brendon:

The way I have been passing information back from the selection of a popup button has been to
assign a variable to the title of the popup button. This will always reflect the current selection of the button.

This should work:

on action theObject
set theWindow to the window of theObject
if name of theObject is "control" then
set myVariable to title of popup button "control" of theWindow
end if
end action

Hope this helps.

-Andrew

>Message: 2
>Date: Sun, 28 Dec 2003 22:59:51 -0900
>Subject: How to pass a selected NSPopUpButton value to a variable
>From: Brendon Bruns <email@hidden>
>To: <email@hidden>
>
>Hi!
>
>I am using a simple pop up button (NSPopUpButton) with two values in it that
>the user can select: 1 or 0
>
>I am trying to figure out how to pass the selected value (either 1 or 0) to
>an AppleScript variable. The name of the pop up button is 'control'. This
>is the code I have so far:
>
>on action theObject
>
> if name of theObject is "control" then
> set myVariable to contents of data cell "control"
>
> end if
>
>end action
>
>Whenever I execute this script, I get an error: -1708
>
>Thanks for any help!
>Brendon Bruns
_______________________________________________
applescript-studio mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-studio
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.