lotus



previous page: X02) Why do I get the error "There must be only one non-shell widget which is son of Toplevel"?
  
page up: BETA Programming Language FAQ
  
next page: X04) Why do I get the error "clockWidgetClass: undefined" when linking my AwEnv program using the xt/v1.8 libraries?

X03) How do I get a separate window for my widget?




Description

This article is from the FAQ, by with numerous contributions by others.

X03) How do I get a separate window for my widget?

Widgets that create separate windows which can be individually moved,
resized, and so on, by the window manager are specializations of the Shell
pattern. Normally you would use a TopLevelShell (the pattern used for the
TopLevel widget created by default by XtEnv).

To make the following Athena Label appear in a separate window

   goodbye: @Label(# init:: (# do 'Goodbye World'->label #)

you would wrap a TopLevelShell around it:

   byewindow: @TopLevelShell
     (# goodbye: @Label
          (# init:: (# do 'Goodbye World'->label #) #);
        init:: (# do goodbye.init #);
     #);

To make the window appear, it should be initialized like any other widget,
and then the Shell method popup should be invoked:

   byewindow.init;
   byewindow.popup;

Notice that the first widget initialized by a program will by default become
a child of the TopLevel widget (see question X02), and will thus be in a
separate window.

There are other possible shells to use, such as OverrideShell. The
OverrideShell has gotten its name because although it creates a separate top
level window, it overrides all requests from the window manager, and will
therefore not be resizable, etc.

 

Continue to:















TOP
previous page: X02) Why do I get the error "There must be only one non-shell widget which is son of Toplevel"?
  
page up: BETA Programming Language FAQ
  
next page: X04) Why do I get the error "clockWidgetClass: undefined" when linking my AwEnv program using the xt/v1.8 libraries?