[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

1116.0. "More than one widget trees allowed?" by USHS11::CHANG () Mon Jul 17 1989 12:47

I want to use high level widget routines (VAX binding, Pascal) to build two
widget trees from one process.  From my program, I called Dwt$Main_Window and
Dwt$Dialog_Box twice after called to Xt$Initialize, only the first main window
showed on the screen.  I then called Xt$Initialize also twice, this time both
main windows showed on the screen with first main window on top of the second
one.  However, messages "X Toolkit Warning: Initializing Resource Lists twice" 
and "X Toolkig Warning: Initializing translation manager Twice" were given.

My questions are:

1. Is it legal to have more than one widget trees?  where in the documentaion
   describing this issue?
2. The program will run with warnings, can I ignore the warning messages?
3. Windows always appears on location (0,0) and ignore the location hints, why?

The C version of my testing program are listed below.
 
#include <stdio.h>
#ifdef VMS
#include <decw$include/DwtAppl.h>
#else
#include <X11/DwtAppl.h>
#endif

int main (argc,argv)
    unsigned int argc;
    char **argv;
{
    Widget TopLevel1, TopLevel2, Main1, Main2, Dialog1, Dialog2;
    DwtCompString Str1, Str2;

    Str1 = DwtLatin1String ("Dialog1");
    Str2 = DwtLatin1String ("Dialog1");

    TopLevel1 = XtInitialize ("HI1", "L3Xt1", NULL, 0, &argc, argv);
    TopLevel2 = XtInitialize ("HI2", "L3Xt2", NULL, 0, &argc, argv);

    Main1 = DwtMainWindow (TopLevel1, "Main1", 200, 200, 100, 100);
    Main2 = DwtMainWindow (TopLevel2, "Main2", 500, 200, 100, 100);

    Dialog1 = DwtDialogBox (Main1, "Dialog1", False, 100, 100, Str1, 
				DwtWorkarea);
    Dialog2 = DwtDialogBox (Main2, "Dialog2", False, 100, 100, Str2, 
				DwtWorkarea);

    XtManageChild (Main1);
    XtManageChild (Main2);

    XtManageChild (Dialog1);
    XtManageChild (Dialog2);

    XtRealizeWidget (TopLevel1);
    XtRealizeWidget (TopLevel2);

    XtMainLoop ();
}

T.RTitleUserPersonal
Name
DateLines
1116.1GVRIEL::SCHOELLERWho&#039;s on first?Mon Jul 17 1989 15:2215
1. Yes but you don't do it with XtInitialize called twice.
2. You can do it without warnings.
3. The locations of the windows can be given by applying location to the
   shell widgets or with geometry specifications in the .dat file (preferable).

What you should do if you are going to have multiple toplevels is to create
them with XtAppCreateShell.  Make them applicationShellWidgetClass.  If they
are going to serve different purposes and you can rely on the original staying
around then you can use the one from XtInitialize.  If they are all equal and
you would like to have a single piece of code with no special cases for
creating and deleting top levels, then don't put any children in the widget
returned by XtInitialize and don't realize it.  The latter case is what we do.

Dick