问题
I want to use XmCreate{Error|Warning|Info}Dialog to display some message in screen in my SDL based application before its main window is open and any program data is available. I want the dialog to open, print the intended message, and when the user clicks on the OK button, the dialog plus the top widget I had to create for it should be closed/removed. Now afaik XtAppMainLoop will loop and process top widget messages (a window?) until the user closes it. I want to close it when the dialog returns though. How can I do that?
回答1:
After hours and hours of googling and reading I have found out that you can use XtAppSetExitFlag (XtAppContext).
回答2:
It's easy, in the XtAppContext that is returned from XtAppMainLoop, just do p->exit_flag = 1;
.
It's also common for applications to simply include their own main loop and do whatever they want. All XtAppMainLoop does is call XtAppNextEvent(app, &event)
and then XtDispatchEvent(&event)
.
来源:https://stackoverflow.com/questions/1386319/how-to-kill-xtappmainloop-motif