Not a long time ago i was force to find a way to display an Alert Dialog on MAC OS X
and here is a basic sequence to display a modal dialog on the mac similar to Win32 MessageBox
{
DialogRef alert;
DialogItemIndex outHit;
CFStringRef errMsg;
CFStringRef errorExplanation;
UInt32 textLength;
alertStringExplanation = SomeUTF String
alertStringTitle = SomeUTF String
l1 = alertStringExplanation.length();
l2 = alertStringTitle.length();
textLength = l2;
errMsg = ::CFStringCreateWithBytes(NULL, (UInt8 *) alertStringTitle.get(), textLength, CFStringGetSystemEncoding(), false);
textLength = l1;
errorExplanation = ::CFStringCreateWithBytes(NULL, (UInt8 *) alertStringExplanation.get(), textLength, CFStringGetSystemEncoding(), false);
UInt32 numUnicodeChars = ::CFStringGetMaximumSizeForEncoding(textLength, kCFStringEncodingUnicode);
CreateStandardAlert(kAlertCautionAlert, errMsg, errorExplanation, NULL, &alert);
RunStandardAlert(alert, NULL, &outHit);
}
Tuesday, July 01, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment