Topic: APLX Help : System Classes : List of Classes : Label
[ Previous | Next | Contents | Index | APL Home ]


Alternative name: Static


The Label (or Static) class implements simple text labels.

Normally you need to set only the caption property, which determines the text displayed, and the where property, to determine where it is placed on the window. You can also set the font, color and enabled properties for special effects (if enabled is 0, the text is grayed out).

Under Windows and Linux only. the style property for a static text object sets the text alignment:

 0 =  Left justified
 1 =  Centered
 2 =  Right justified

plus optional bits:

  4 = Inhibit prefix (interpretation of '&' as accelerator key (Windows, Linux only)
  8 = Inhibit word-wrap if the text is too wide for the label
 32 = Inhibit auto-sizing of the label to ensure text fits
128 = Text is transparent (Windows, Linux only)

Event handling is not usually relevant to Label objects, but sometimes it is useful to define an onMouseDown callback. In this case, you should usually provide some visual indication to the user that the text is capable of responding to mouse events, for example by displaying it in a special color or underlining it using the font property. This can be used for 'hypertext' type applications where the user clicks on a word for more information about it.

Note: Another way of displaying text on a window or control is to use the Draw method. This provides more flexibility in specifying the font colors and transparency, and also allows you to write text at any angle. Under Windows, it is also useful where you want the text to appear over another control; Label objects always display behind windowed controls such as Buttons.


[1]   ⍝ Sample function demonstrating use of the Label object
[2]   DEMO←'⎕' ⎕NEW 'Window' ⋄ DEMO.scale←1
[3]   DEMO.title←'Label Example'
[4]   ⍝
[5]   DEMO.LABEL1.New 'Label'
[6]   DEMO.LABEL1.caption←'Today''s Work Plan'
[7]   DEMO.LABEL1.where←2 1 1 30
[8]   DEMO.LABEL1.font←'Helvetica' 1 1 ⍝ Bold text
[9]   ⍝
[10]  DEMO.LABEL2.New 'Label'
[11]  DEMO.LABEL2.caption←'Tidy up the office!'
[12]  DEMO.LABEL2.where←4 1 1 30
[13]  DEMO.LABEL2.enabled←0
[14]  ⍝
[15]  DEMO.LABEL3.New 'Label'
[16]  DEMO.LABEL3.caption←'Have lunch'
[17]  DEMO.LABEL3.where←6 1 1 30
[18]  DEMO.LABEL3.font←'Helvetica' 1 0
[19]  DEMO.LABEL3.color←255
[20]  ⍝
[21]  ⍝ Wait for the user to close the window
[22]  0 0⍴⎕WE DEMO


align anchors aquaadjust autodraw caption children class color data dragsource droptarget enabled events extent font maxsize methods minsize name opened pointer properties scale self size sourceformats style targetformats tie tooltip units visible where


Click Clienttoscreen Close Create Delete Hide New Open Paint Resize Screentoclient Send Set Show Trigger


onClick onClose onDblClick onDestroy onDragDrop onDragEnd onDragEnter onDragLeave onDragOver onDragStart onHide onMouseDown onMouseMove onMouseUp onOpen onSend onShow

Topic: APLX Help : System Classes : List of Classes : Label
[ Previous | Next | Contents | Index | APL Home ]