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);