Stop XtAppMainLoop (app)

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

4 posts / 0 new
Last post
Stop XtAppMainLoop (app)

Submitted by Anonymous on Tue, 10/21/2003 - 09:29.

Dear reader,

As far as I know, a program is set up like

widget = XtVaOpenApplication (&app, ...)

...
...

XtAppMainLoop (app)

The problem that I have is as follows
When I am calling for a warningdialog, I want to stop the MainLoop and go on with it after I pressed the "Ok" button.

At this moment, the warningdialog is opened and everything else is handled. I want that "everything else" to be handled after I pressed the "Ok" button.

Does someone have an idea what I am doing wrong?

Regards
ASc.

Tue, 10/21/2003 - 14:45#1

Tue, 10/21/2003 - 14:45#1

Anonymous

Stop XtAppMainLoop (app)

You are not doing anything wrong. You just have to add to your
code one of two things.
The quick and dirty (and many will say, inelegant) way would be to introduce a loop controlled by a flag that gets tripped after you click your dialog`s OK button. This loop can be your own or a loop created with a call to "XtCreateAppTimeout" which essentially creates a select loop with a handler method you supply that will loop until you trip the flag.
The second more elegant approach would be to introduce threading to your program. But keep in mind the "main" thread should contain the loop created by XtAppMainLoop. This thread controls all the GUI and callback events. You can introduce a thread for subordinate processing that you can stop and start much easier. This issue can open up a huge, ugly can of worms, however and much more planning would need to be done. Start small and look for deadlock issues at every iteration.
If this is an existing application, then you may want the quick and dirty method described above. But if you`re just starting out, threads can be a good approach.

steve---

Wed, 10/22/2003 - 11:18#2

Wed, 10/22/2003 - 11:18#2

Anonymous

Stop XtAppMainLoop (app)

Dear sorton9999,

Thank you for your help. It worked with the "threading".

 

Mon, 10/27/2003 - 21:16#3

Mon, 10/27/2003 - 21:16#3

ICS_support

Stop XtAppMainLoop (app)

The comp.windows.x FAQ has example code of this under a question titled something like "how do I handle a dialog `in-line`?"