MessageLoop

Discussions related to Visual Prolog
User avatar
Ferenc Nagy
VIP Member
Posts: 216
Joined: 24 Apr 2007 12:26

MessageLoop

Unread post by Ferenc Nagy » 26 Dec 2015 16:23

What does the messageLoop:run do in the following main program?

Code: Select all

implement main     open core   clauses     run() :-         _ = mainForm::display(window::getScreenWindow()),         messageLoop::run().   end implement main   goal     mainExe::run(main::run).
What happens if I omit it?
TIA, Regards,
Frank Nagy

User avatar
Thomas Linder Puls
VIP Member
Posts: 1158
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 26 Dec 2015 20:45

Then your program will simply terminate having done nothing.

The message loop receives windows messages from the message queue and dispatch them to the relevant handling code.
Regards Thomas Linder Puls
PDC

User avatar
Ferenc Nagy
VIP Member
Posts: 216
Joined: 24 Apr 2007 12:26

How to run a program without task window

Unread post by Ferenc Nagy » 27 Dec 2015 12:34

Thank you, Thomas.
Explanation for other readers
The quoted main program invokes a form without task window, menu, and other ornaments.
The corresponding two lines of a main program for a MDI project look like this:

Code: Select all

TaskWindow = taskWindow::new(),         TaskWindow:show(),
Hint: I have found the asked main program in the Russian example program Life
among other interesting example programs.
TIA, Regards,
Frank Nagy

User avatar
Thomas Linder Puls
VIP Member
Posts: 1158
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 27 Dec 2015 14:05

Actually, the vpi::init call in an MDI application corresponds to the messageLoop::run call.
Regards Thomas Linder Puls
PDC

Post Reply