lotus

previous page: F08) Can <<Attributes>> be used instead of <<AttributeDecl>>?
  
page up: BETA Programming Language FAQ
  
next page: X02) Why do I get the error "There must be only one non-shell widget which is son of Toplevel"?

X01) Why does my label widget sometimes get the attribute name as label-string, and sometimes not?




Description

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

X01) Why does my label widget sometimes get the attribute name as label-string, and sometimes not?

The following BETA program creates a window containing "Label"

   ORIGIN '~beta/Xt/current/awenv'
   --- program: descriptor ---
   AwEnv
   (# Hello: @Label;
   do Hello.init;
   #)

whereas the following program creates a window containing "Hello"

   ORIGIN '~beta/Xt/current/awenv'
   --- program: descriptor ---
   AwEnv
   (# Hello: @Label(##);
   do Hello.init;
   #)

Why?

The connection between the names used for widgets in BETA and the external
names used in the external widgets interfaced to from BETA is that the
pattern name of the BETA widget is used for the external widget name by
default. In the first example, the Hello widget is an instance of the
pattern Label, and in the second example the widget is the only possible
instance of the singular pattern Label(##), which is named Hello.

The appearance of the windows in this case comes from the fact that the
Athena Label widget uses the external name of the widget as default
label-string, if it is not specified otherwise. A variant of this problem is
the case where you specify a list of widgets using the same pattern:

   hello1, hello2: @Label(##);

In this case the default name will always be the first name in the list,
hello1. To avoid this behavior, use the scheme

   hello1: @Label(##);
   hello2: @Label(##);

or specify the name explicitly instead.
See the X Windows Libraries Manual p5-7 for more details.


 

Continue to:













TOP
previous page: F08) Can <<Attributes>> be used instead of <<AttributeDecl>>?
  
page up: BETA Programming Language FAQ
  
next page: X02) Why do I get the error "There must be only one non-shell widget which is son of Toplevel"?