0
我试图从一个非常简单的应用程序内创建一个简单的对话框。它是应用程序中唯一的UI。但是当我调用RunStandardAlert时,这些按钮是不响应的,并且函数调用永远不会返回。我没有在应用程序的其他地方使用Carbon或Cocoa。RunStandardAlert永不返回,按钮没有响应
这是我使用的代码,来自Carbon教程。我直接从我的main()函数调用这个函数,但我也尝试在使用InstallEventLoopTimer()注册一个事件循环计时器之后调用了RunApplicationEventLoop(),所以我可以从那里调用下面的代码以防万一发生某些魔法时你运行你的应用程序事件循环来完成对话框工作所需的设置(voodoo!)。
DialogRef theItem;
DialogItemIndex itemIndex;
CreateStandardAlert(kAlertStopAlert, CFSTR("Oh dear, the penguin’s disappeared."),
CFSTR("I hope you weren’t planning to open source him."), NULL, &theItem);
RunStandardAlert (theItem, NULL, &itemIndex);