Entry() - initialization
  Xui() initializes GuiDesigner.
  InitGui() initializes message variables in your program.
  InitProgram() initializes your program.

If your program calls library functions, their initialization functions should be called after Xui().

Entry() - create windows
CreateWindows() is a function that calls the grid functions that create the windows in your program.  Each time you design a new window for your program, GuiDesigner adds code to CreateWindows() to create, activate, and display the window.

The code typically looks like the following:

  Design (@Design, #Create, x, y, width, height, 0, &XuiWindow())
  XuiSendMessage ( Design, #SetCallback, Design, &DesignCode(), -1, -1, -1, 0)
  XuiSendMessage ( Design, #DisplayWindow, 0, 0, 0, 0, 0, 0)

This creates a window, sets its callback function, and displays it.  Comment out the DisplayWindow line for any window you don't want to appear when your program starts up.

These three lines set the following important example:
  Your programs must call grid functions directly to create grids and windows.
  Your programs can send all other messages with XuiSendMessage().

Specifically, your programs must call grid functions directly with Create and CreateWindow messages. For all other messages your programs can call XuiSendMessage() and let it look up and call the function associated with the grid argument.

Entry() - message loop
The message loop is the base of operation for your program.

XgrProcessMessages(1) goes to sleep until a message becomes available.  This keeps your program from wasting computer time, and lets other programs run when they can.

When the user operates the keyboard or mouse, GraphicsDesigner adds a message to the queue and wakes up XgrProcessMessages() .

XgrProcessMessages(1) calls the window function associated with the message.  The window function processes the message and returns, or sends the message to a grid function, then returns.

Until processing a message makes terminateProgram non-zero, the message loop repeats indefinitely.