The ProXT programming model

The ProXT programming model can be summarized best in the following program example, which creates a push button, and maps it on the screen.

     create_button :-
             xtAppInitialize(App,'Demo',[],Shell),
             xmCreatePushButton(Shell,push_button,
                                [xmNwidth(100), xmNheight(100)],Button),
             xtManageChild(Button),
             xtRealizeWidget(Shell),
             xtAppMainLoop(App).
     

First, the Toolkit must be initialized. The call to xtAppInitialize/4 returns an application context and a shell widget, which is the root widget of the application. The second argument is the application class, attributes can be specified in the third argument. Then the push button widget is created as a child of the shell widget with the call to xmCreatePushButton/4. In order to be visible on the screen a widget must be managed. This is accomplished with the call to xtManageChild/1. Note that the shell widget should not be managed. The next step is to realize every widget. This can be achieved by realizing the root widget. xtRealizeWidget/1 propagates the realization recursively to all of the children. Then the program must enter the event loop by calling xtAppMainLoop/1 where the server dispatches events for the widgets in this application context and certain actions that occur within the application.