[comp.windows.x] mapping multiple

pattersw@cs.rpi.edu (William Patterson) (07/27/90)

I am trying to display 2 independent sets of widgets (i.e. both are
direct children of the root widget).  However, when
XtRealizeWidget(rootWidget) is called, only one of the children is
mapped.

Below is a simple example of what I want to do.  It creates 2 label
widgets, but only one of them is mapped.

Does anyone know how to get both of them to show up?

=============================================================================

#include <stdio.h>
#include <X11/Intrinsic.h>	

#include <X11/Xaw/Label.h>	
#include <X11/Xaw/Cardinals.h>	

String fallback_resources[] = { "*Label.Label:    This is xlabel",
				  NULL };
 
static XrmOptionDescRec options[] = {
{"-label",	"*Label.label",	XrmoptionSepArg,	NULL}
};

main(argc, argv)
int argc;
char **argv;
{
    static void Syntax();
    XtAppContext app_con;
    Widget toplevel;

    toplevel = XtAppInitialize(&app_con, "Xlabel", options, XtNumber(options),
			       &argc, argv, fallback_resources, NULL, ZERO);

    (void) XtCreateManagedWidget("label", labelWidgetClass, toplevel, 
				 NULL, ZERO);
    (void) XtCreateManagedWidget("label2", labelWidgetClass, toplevel, 
				 NULL, ZERO);
    XtRealizeWidget(toplevel);
    XtAppMainLoop(app_con);
}
================================== end =====================================

-- 

-----------------------------------
Bill Patterson
pattersw@turing.cs.rpi.edu

Computer Science Department
Rensselaer Polytechnic Institute
Troy, NY.

"Jane, you ignorant slut."
-----------------------------------

rlh2@ukc.ac.uk (Richard Hesketh) (07/28/90)

In article <_Z3$!T%@rpi.edu> pattersw@cs.rpi.edu (William Patterson) writes:

>I am trying to display 2 independent sets of widgets (i.e. both are
>direct children of the root widget).  However, when
>XtRealizeWidget(rootWidget) is called, only one of the children is
>mapped.

To quote page 66 of the Intrinsics manual (section 5.2):

	"None of the Intrinsics-supplied pop-shells (sic) will
	 simultaneously manage more than one child."

So that is why you will only ever see one managed widget.  Worse than
that this one widget is always the same size as the shell it is stuck
in (either the size as defined by the widget or as defined by the size of
the shell if it is set).   To get around this you must place the two
labels in a composite parent whose parent is the shell, a box or a form
will do.

If you want to display a widget directly you should create it *unmanaged*
and then do an explicit XtMapWidget().  I don't think you'll want to do
that in this case though.

>Bill Patterson
>pattersw@turing.cs.rpi.edu

Richard Hesketh   :   @nsfnet-relay.ac.uk:rlh2@ukc.ac.uk
		  :   rlh2@ukc.ac.uk    ..!mcsun!ukc!rlh2
---                                               
Computing Lab., University of Kent at Canterbury,
Canterbury, Kent, CT2 7NF, United Kingdom.    Tel: +44 227 764000 ext 7620/3682

pattersw@cs.rpi.edu (William Patterson) (07/31/90)

A few days ago I asked about how one goes about getting multiple
independent widgets to appear on the screen.  Almost everyone
misunderstood what I meant by independent.  By independent I mean that
I need to be able to operate on the widgets as independent windows.
I need to be able to resize and iconify them individually, as well as
move them on top of one another.

The Box, Form, etc. widgets do not allow me to do this.  True, they
can put multiple widgets on the screen, but not *indpendent* of each
other.

I have 2 general suggestions on how to go about this, but all I have
is a reference manual for Xt, so expanding outlines into programs can
be tough.  I'm reposting because *someone* out there must have already
written some code to do this, which would save me time trying to parse
the reference manual.

Anybody...?  Please...?  For a cookie...?



-- 

-----------------------------------
Bill Patterson
pattersw@turing.cs.rpi.edu

Computer Science Department
Rensselaer Polytechnic Institute
Troy, NY.

"Jane, you ignorant slut."
-----------------------------------