Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > bug in NSAlert?

bug in NSAlert?
Thread Tools
Dedicated MacNNer
Join Date: May 2002
Location: Brooklyn, NY
Status: Offline
Reply With Quote
Jun 14, 2004, 10:36 PM
 
Hi,
Has anybody tried adding more than 4 buttons to an NSAlert? Whenever I do, I get runtime exceptions. If you add more than 4 buttons, it throws the exception on the last one, regardless of how many. Does this happen to anyone else? I've checked the documentation and there's no mention of a limit of 4 buttons, so I don't think that's the problem.

I've tried os 10.3.1 and 10.3.4, xcode 1.1 and 1.2 (not that that should change it).

Is this a known bug?

gabe
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Jun 15, 2004, 09:52 AM
 
Three buttons is all you get.

From the docs for one of the NSAlert's:

Creates and runs an alert sheet on docWindow, with the title of title, the text of msg, and buttons with titles of defaultButton, alternateButton, and otherButton
The vargs are for other properties, but not buttons.

Matt Fahrenbacher
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jun 15, 2004, 10:15 AM
 
Originally posted by Ghoser777:
Three buttons is all you get.

From the docs for one of the NSAlert's
You're looking at the wrong thing. Zimwy was referring to the NSAlert class:
The NSAlert class, which was introduced in Mac OS X v10.3, supersedes the functional Application Kit API for displaying alerts (NSRunAlertPanel, NSBeginAlertSheet, and so on). The former API is still supported, but you are encouraged to use the NSAlert class for your application’s alert dialogs.
This class purports to support more than 3 buttons:
If you have more than three buttons on your alert, the button-position return value is NSAlertThirdButtonReturn + n, where n is an integer. For languages that read right to left, the first button’s position is closest to the left edge of the dialog or sheet.
I just had a quick play and found the same thing that Zimwy did - it randomly breaks and throws an exception if you have more than 4. This appears to be a bug.
     
Zimwy  (op)
Dedicated MacNNer
Join Date: May 2002
Location: Brooklyn, NY
Status: Offline
Reply With Quote
Jun 15, 2004, 11:27 AM
 
Okay, wonderful. I've submitted the bug to apple. It's surprising that nobody's tried to add more than 4 buttons yet.

gabe
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Jun 15, 2004, 11:39 AM
 
I forgot about that class... this is what happens when you essentialyl stop programming for 9 months.

Matt Fahrenbacher
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jun 15, 2004, 01:18 PM
 
Originally posted by Ghoser777:
I forgot about that class... this is what happens when you essentialyl stop programming for 9 months.
NSAlert was just added in Panther. If you haven't been using Cocoa in the past nine months, I'm not surprised you didn't notice it. I have been using Cocoa, and I still only barely noticed it.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jun 15, 2004, 02:28 PM
 
You mean you don't rabidly read the release notes to see what's new with every release? Wow, weirdos.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:35 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2