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: Can't click on StandardAlert button



Behavior like that happens in applications, at best, if you launch the alert
from a thread that's not the main thread. If that's the case, there's not
anything you really can do about that other than rewriting your code to bring
up the alert within your main thread, typically via some CarbonEvent posting.


Also, you need to make your message and explanation strings to be Pascal
strings, not C-strings.  Pascal strings are explicitly unsigned character
arrays (the zeroth byte goes from 0 to 255 for the length of the string), so
you wouldn't need to do the typecast you're doing in your call.  If you're not
familiar with that method of declaration, this is how it would be:

    unsigned char *alert1 = "\p Licence file cannot be found.  ";
    unsigned char *alert2 = "\p Please obtain a licence file.  ";

Quoting "J.P. Pellet" <email@hidden>:

I am porting an old application based on the YAAF multi-platform
framework to Carbon. It displays an alert using StandardAlert;
however, I can't click on the OK button and I have to kill the
application.


Here is a piece of code that exhibits exactly the same behavior.

#include <Carbon/Carbon.h>
int main (int argc, char * const argv[]) {
	SInt16 out;
	char *alert1 = " Licence file cannot be found.  ";
	char *alert2 = " Please obtain a licence file.  ";
	StandardAlert (kAlertNoteAlert,
				   (constunsignedchar *) alert1,
				   (constunsignedchar *) alert2,
				   NULL,
				   &out);
	printf("response: %i\n", 5, out);
	return 0;
}

I saw in a previous post (http://lists.apple.com/archives/printing/2003/Nov/msg00047.html
) that it is a problem with "with user and bootstrap context". Unfortunately, that doesn't tell me much, and my app does have to
display such warning dialogs. Anything I'm doing wrong? I'm quite new
to Carbon.


TIA,
J.P. _______________________________________________
Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden


This email sent to email@hidden




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >Can't click on StandardAlert button (From: "J.P. Pellet" <email@hidden>)



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.