SIZE phrase

Specifies the width and height of a widget. You can express the dimensions in either character units or pixels.

Syntax

{ SIZE | SIZE-CHARS | SIZE-PIXELS } width BY height
{ SIZE | SIZE-CHARS }
Specifies that the unit of measure is characters.
SIZE-PIXELS
Specifies that the unit of measure is pixels.
width
Specifies the width of the widget. If the units are characters, width must be a decimal constant. If the units are pixels, width must be an integer constant.
height
Specifies the height of the widget. If the units are characters, the value height must be a decimal constant. If the units are pixels, height must be an integer constant.

Example

The following example uses SIZE phrases to set the initial dimensions of the rectangle rec and to set the dimensions of the frame sz-frame. When you choose the b_size button, the rectangle is randomly resized.

r-size.p

DEFINE BUTTON b_quit LABEL "Quit"
  TRIGGERS:
    ON CHOOSE QUIT.
  END.
  
DEFINE BUTTON b_size LABEL "Size It".
DEFINE RECTANGLE rec SIZE 5 BY 5.
DEFINE FRAME butt-frame
  b_size b_quit
  WITH CENTERED ROW SCREEN-LINES - 2.

DEFINE FRAME sz-frame
  SKIP(1) SPACE(1) rec 
  WITH SIZE 80 BY 10 TITLE "The rectangle is 5 by 5".
  
ON CHOOSE OF b_size IN FRAME butt-frame
  ASSIGN 
    rec:WIDTH-CHARS IN FRAME sz-frame = 
      RANDOM(1, FRAME sz-frame:WIDTH-CHARS - 3) 
    rec:HEIGHT-CHARS     = RANDOM(1, FRAME sz-frame:HEIGHT-CHARS - 2)
    FRAME sz-frame:TITLE = "The rectangle is " + STRING(rec:WIDTH-CHARS) + 
      " by " + STRING(rec:HEIGHT-CHARS).ENABLE rec WITH FRAME sz-frame.

ENABLE b_size b_quit WITH FRAME butt-frame.
WAIT-FOR CHOOSE OF b_quit IN FRAME butt-frame.

Notes

See also

COMBO-BOX phrase, DEFINE BROWSE statement, DEFINE BUTTON statement, DEFINE IMAGE statement, DEFINE RECTANGLE statement, EDITOR phrase, Frame phrase, RADIO-SET phrase, SELECTION-LIST phrase, SLIDER phrase