drapeau@choctaw.Stanford.EDU (George Drapeau) (08/13/89)
Included in this posting is a short X Toolkit program I wrote to test
popup shells. The program makes two shells, each with a Box
containing a Command widget.
There are a couple of strange things about this (seemingly) simple
program, though. First of all, the popup widget doesn't get its own
title bar (I use twm as my window manager, if that makes a
difference). Also, if I put the "XtPopup(popup)" call after the
XtRealizeWidget(topLevelShell) call, I don't even get the popup shell.
Why is this, and where could I have read to understand why?
Platform: Sun4/110, SunOS4.0.1, X11R3 (with patches 1-9 + Purdue
Speedups). This same behavior occurs on a microVAX 3200, too.
Any help you could provide (including pointers to the relevant
documentation) would be greatly appreciated.
Thanks in advance,
George
------------ cut here ------------
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Box.h>
#include <X11/Command.h>
#include <X11/Shell.h>
Widget topLevelShell,popup;
void main(argc,argv)
int argc;
char **argv;
{
Widget box,command;
void MakePopup();
topLevelShell = XtInitialize("small","Test",NULL,0,&argc,argv);
box = XtCreateManagedWidget("Box",boxWidgetClass,topLevelShell,NULL,0);
command = XtCreateManagedWidget("Command",commandWidgetClass,box,NULL,0);
MakePopup();
XtPopup(popup);/* Try moving this after the "XtRealizeWidget" line...*/
/* ... and see what happens. */
XtRealizeWidget(topLevelShell);
XtMainLoop();
}
void MakePopup()
{
Widget myBox,myCommand;
popup = XtCreatePopupShell("Pop",shellWidgetClass,topLevelShell,NULL,0);
myBox = XtCreateManagedWidget("box2",boxWidgetClass,popup,NULL,0);
myCommand = XtCreateManagedWidget("Push",commandWidgetClass,myBox,NULL,0);
}
--
______________________________________________________________________________
George D. Drapeau Internet: drapeau@jessica.stanford.edu
Academic Information Resources
Stanford Universityconverse@EXPO.LCS.MIT.EDU (Donna Converse) (08/15/89)
> First of all, the popup widget doesn't get its own > title bar (I use twm as my window manager, if that makes a > difference). Also, if I put the "XtPopup(popup)" call after the > XtRealizeWidget(topLevelShell) call, I don't even get the popup shell. Calling XtPopup before realizing the parent of the popup works fine here. But you have the wrong number of arguments to XtPopup, and your popup shell type was given as shellWidgetClass, which is an internal class and should not be instantiated. Use transientShellWidgetClass instead. Read chapters 4 "Shell Widgets" and 5 "Pop-up Widgets" in "X Toolkit Intrinsics" Donna Converse converse@expo.lcs.mit.edu