Check Box - Caption Property

Text to be displayed within the control

Member of Check Box (PRIM_CKBX)

Data Type - String


The Caption property specifies the text to be displayed within the checkbox.
A caption can be either a literal string or a Multilingual Variable that will show the correct string for the current runtime language. If the caption is too long to fit in the control it will be clipped or show ellipses, depending on the value specified in the Ellipses property.
For Windows applications, embedding an ampersand (&) in the caption will assign an access key to the control of the character immediately to the right of the ampersand.
When the ALT key is down, this character will emulate a mouse click.


In this example, the top checkbox can be access via Alt+N and the second using ALT+F.
Function Options(*Direct)
Begin_Com Role(*Extends #Prim_form) Height(300) Top(199) Width(533) Clientwidth(517) Clientheight(261) Left(231)
   Define_Com Class(#PRIM_CKBX) Name(#CheckBox1) Caption('O&n or Off') Displayposition(1) Left(176) Marginleft(2) Parent(#COM_OWNER) Tabposition(1) Top(56) Height(43) Width(146)
   Define_Com Class(#PRIM_CKBX) Name(#CheckBox2) Caption('On or O&ff') Displayposition(2) Left(176) Marginleft(2) Parent(#COM_OWNER) Tabposition(2) Top(99) Height(43) Width(146) Ellipses(End)
   Define_Com Class(#PRIM_CKBX) Name(#CheckBox3) Caption('Both On or Off?') Displayposition(3) Left(176) Marginleft(2) Parent(#COM_OWNER) Tabposition(3) Top(142) Height(43) Width(146) Readonly(True)
   Evtroutine Handling(#CheckBox1.Click #CheckBox2.Click)
      If ((#CheckBox1.ButtonState = Checked) And (#CheckBox2.ButtonState = Checked))
         #CheckBox3.ButtonState := Checked
         If ((#CheckBox1.ButtonState = Unchecked) And (#CheckBox2.ButtonState = Unchecked))
            #CheckBox3.buttonState := Unchecked
            #CheckBox3.buttonState := Grayed

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020