From: lynette@oliver.sun.ac.za (Lynette)
Subject: Re: Looking for Example of XmNmessageWindow
Organization: Rhodes University, Grahamstown, South Africa
X-Newsreader: TIN [version 1.1 PL6]
Date: Mon, 12 Oct 1992 13:45:10 GMT

The following code works (note the typecast in setting the resource):


/*-------------------------------------------------------------------------*/
void MakeMainWindow (Widget wTopWidget)
{
	Widget wWorkWindowWidget=NULL;
	Widget wMenuBar    = NULL;
	Widget wExit = NULL;
    Widget wStatusBar  = NULL;
    Widget wLabel = NULL;
    Widget wMainWindow = NULL;
 
	Arg    pArgs[15];
	int    nArgs=0;
    XmString MsgString=NULL;

    /* Create the main window
    */	
	nArgs=0;
	XtSetArg(pArgs[nArgs], XmNshowSeparator, TRUE); nArgs++;
	XtSetArg(pArgs[nArgs], XmNscrollBarDisplayPolicy,XmSTATIC); nArgs++;
	XtSetArg(pArgs[nArgs], XmNscrollingPolicy, XmAUTOMATIC); nArgs++;
	XtSetArg(pArgs[nArgs], XmNscrollBarPlacement, XmBOTTOM_RIGHT); nArgs++;
	XtSetArg(pArgs[nArgs], XmNvisualPolicy, XmCONSTANT); nArgs++;
	wMainWindow = XmCreateMainWindow(wTopWidget,"main",pArgs,nArgs);
   	XtManageChild(wMainWindow);

    /* Create the working area of the main window
    */
	nArgs = 0;
	XtSetArg(pArgs[nArgs],XmNborderWidth,2); nArgs++;
	wWorkWindowWidget = XmCreateDrawingArea(wMainWindow,"WorkArea",pArgs,nArgs);
	XtManageChild(wWorkWindowWidget);

    /* Create the main menu
    */
	nArgs = 0;
	wExit = XmCreatePushButton(wMainWindow,"exit",pArgs,nArgs);
	XtManageChild(wExit);

    /* Create the status bar
    */
    nArgs=0;
	XtSetArg(pArgs[nArgs],XmNborderWidth,2); nArgs++;
	wStatusBar = XmCreateBulletinBoard (wMainWindow, "bb", pArgs,nArgs);
	XtManageChild(wStatusBar);

    nArgs=0;
    MsgString = XmStringCreateSimple ("Hier's die boodskaparea dan!");
	XtSetArg(pArgs[nArgs],XmNlabelString,MsgString); nArgs++;
	wLabel = XmCreateLabel(wStatusBar, "label", pArgs,nArgs);
	XtManageChild(wLabel);

	nArgs = 0;
	XtSetArg(pArgs[nArgs],XmNmessageWindow, (XtArgVal) wStatusBar); nArgs++;
	XtSetValues(wMainWindow, pArgs, nArgs);

    XmMainWindowSetAreas(wMainWindow,wMenuBar,NULL,NULL,NULL,wWorkWindowWidget);

}

 
/*-------------------------------------------------------------------------*/
/*
** The MAIN FUNCTION of the program. This function does argument checking,
** allocates root data structures for the program and calls functions to 
** build the Xt menus and the uid hierarchy. Once all initialisation is 
** complete it calls XtMainLoop() to begin processing events. 
*/
/*-------------------------------------------------------------------------*/

void main(unsigned argc, char **argv)
{
    Widget wTopWidget = NULL;
	Widget wWorkWindowWidget=NULL;
	Widget wMenuBar    = NULL;
	Widget wExit = NULL;
    Widget wStatusBar  = NULL;
    Widget wLabel = NULL;
    Widget wMainWindow = NULL;
    XtAppContext app_context;
 
	Arg    pArgs[15];
	int    nArgs=0;
    XmString MsgString=NULL;

    wTopWidget = XtAppInitialize(&app_context,"AppMain", NULL, 0, &argc,
                   argv, NULL, nArgs, 0);
 
    /* Create the main window
    */	
	MakeMainWindow(wTopWidget);

    XtRealizeWidget(wTopWidget);

    /* Call the Xt Event loop to start processing events 
    */
   
    XtAppMainLoop(app_context);
}

/*-------------------------------------------------------------------------*/