Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : DEFINE RECTANGLE statement
 

DEFINE RECTANGLE statement

Defines a rectangle widget that is created at compile time for use within a single procedure or class.
Note: Does not apply to SpeedScript programming.

Syntax

DEFINE [ PRIVATE ] RECTANGLE rectangle[ LIKE rectangle2]
  [ NO-FILL ]
  [{ EDGE-CHARS width}|{ EDGE-PIXELS width}]
  [ DCOLOR expression]
  [ BGCOLOR expression]
  [ FGCOLOR expression]
  [ GRAPHIC-EDGE ]
  [ PFCOLOR expression]
  [ ROUNDED ]
  [ GROUP-BOX ]
  [size-phrase]
  [ TOOLTIP tooltip]
  {[trigger-phrase]}
[ PRIVATE ] RECTANGLE rectangle
Defines and identifies a rectangle widget as a class-scoped object. A class-scoped handle-based object is not a member of a class, but provides a resource that is privately available to the class definition similar to a non-shared data element in a procedure definition. The option to specify the PRIVATE access mode is provided for readability. You cannot specify PRIVATE when defining a rectangle widget as a data element in a method or procedure.
Note: This option is applicable only when defining a class-scoped rectangle widget in a class definition (.cls) file.
RECTANGLE rectangle
Defines and identifies a rectangle widget for access only within the current procedure, class, or method of a class.
LIKE rectangle2
Specifies a previously defined rectangle whose characteristics you want to apply to the new rectangle. If you name a rectangle with this option, you must have defined that rectangle previously in the procedure.
NO-FILL
Indicates that only the outline of the rectangle should be drawn. By default, the rectangle is filled with the background color.
EDGE-CHARS width
Specifies the width of the rectangle outline in characters. The default width is 1. If you do not want an edge on the rectangle, specify EDGE-CHARS 0.
EDGE-PIXELS width
Specifies the width of the rectangle outline in pixels. The default width is 1. If you do not want an edge on the rectangle, specify EDGE-PIXELS 0.
DCOLOR expression
Specifies the fill color of the rectangle in character interfaces. This option is ignored in graphical interfaces.
BGCOLOR expression
Specifies the background color or fill color of the rectangle in graphical interfaces. This option is ignored in character interfaces.
FGCOLOR expression
Specifies the foreground color or edge color of the rectangle in graphical interfaces. This option is ignored in character interfaces.
GRAPHIC-EDGE
Specifies that in a character interface, the rectangle is drawn with graphic characters. This option is ignored in a graphical interface. This overrides the EDGE-CHARS and EDGE-PIXELS options. The border is one graphic unit thick.
PFCOLOR expression
Specifies the edge color of the rectangle in character interfaces. This option is ignored in graphical interfaces. It is also ignored if you specify GRAPHIC-EDGE.
ROUNDED
Specifies that the rectangle appears with rounded corners (whether the display is set to the Windows XP Theme or the Windows Classic Theme).
This option is ignored in character interfaces.
GROUP-BOX
Specifies the rectangle as a group box, which surrounds one or more user interface widgets to visually indicate a relationship among the widgets. The appearance of a group box changes automatically to conform to the current display setting. When the display is set to the Windows XP Theme, the group box rectangle appears with rounded corners and a single-line border. When the display is set to the Windows Classic Theme, the group box appears with square corners and a shaded double-line border.
This option is ignored in character interfaces.
size-phrase
Specifies the outside dimensions of the rectangle widget. This is the syntax for size-phrase:
Syntax
{ SIZE | SIZE-CHARS | SIZE-PIXELS }width BY height
If you specify SIZE or SIZE-CHARS, the units are characters; if you specify SIZE-PIXELS, the units are pixels. For character units, the values width and height must be decimal constants. For pixels units, they must be integer constants. For more information, see the SIZE phrase reference entry.
TOOLTIP tooltip
Allows you to define a help text message for a rectangle widget. The AVM automatically displays this text when the user pauses the mouse button over the rectangle widget.
You can add or change the TOOLTIP option at any time. If TOOLTIP is set to "" or the Unknown value (?), then the ToolTip is removed. No ToolTip is the default. The TOOLTIP option is supported in Windows only.
trigger-phrase
Specifies application triggers for the rectangle.
For more information, see the Trigger phrase reference entry.

Example

The following example uses a set of thin rectangles as lines to create graphic columns within a frame background:
r-bkgrnd.p
DEFINE VARIABLE item-tot AS DECIMAL NO-UNDO LABEL "Value".

DEFINE RECTANGLE vline1 SIZE .4 BY 5 EDGE-PIXELS 2.
DEFINE RECTANGLE vline2 LIKE vline1.
DEFINE RECTANGLE vline3 LIKE vline1.
DEFINE RECTANGLE vline4 LIKE vline1.
DEFINE RECTANGLE vline5 LIKE vline1.
DEFINE RECTANGLE vline6 LIKE vline1.
DEFINE RECTANGLE hline SIZE 78 BY .1 EDGE-PIXELS 2.

DEFINE FRAME item-info
  Item.ItemNum
  Item.ItemName
  Item.OnHand
  Item.ReOrder
  Item.OnOrder
  Item.Price
  item-tot
  BACKGROUND SKIP(1) hline
    vline1 AT 9
    vline2 AT 25
    vline3 AT 33
    vline4 AT 42
    vline5 AT 51
    vline6 AT 65
  WITH TITLE "Inventory Current Value" CENTERED USE-TEXT 5 DOWN.
  
FOR EACH Item NO-LOCK WITH FRAME item-info:
  DISPLAY
    Item.ItemNum
    Item.ItemName
    Item.OnHand
    Item.ReOrder
    Item.OnOrder
    Item.Price
    Item.OnHand * Item.Price @ item-tot.

Notes

*To create the compile-time defined rectangle you are defining, you must define a compile-time defined frame that contains the rectangle. Each frame you define that contains the same rectangle creates an additional instance of that rectangle. The handle for a compile-time defined rectangle is not available until the rectangle is created.
*You can specify an application-defined widget ID for a compile-time defined rectangle widget using the form-item phrase in either the FORM statement or the DEFINE FRAME statement. See the FORM statement and DEFINE FRAME statement reference entries for more information.
*When defining a rectangle, you must specify either the LIKE option or the size phrase.

See also

Class-based data member access, FORM statement