Class CvsOption

This class represents an option button (aka radio button). These are usually grouped together so that only one can be selected at a time.

Hierarchy

  • CvsText
    • CvsOption

Accessors

  • get id(): string
  • The unique identifier for this control.

    Returns string

  • get isEnabled(): boolean
  • This is true if the control can respond to UI events else false.

    Use enable() and disable() to enable and disable it.

    Returns boolean

  • get isOpaque(): boolean
  • This is true if the control background is opaque else false.

    Use opaque() and transparent() display / hide the background.

    Returns boolean

  • get isVisible(): boolean
  • This is true if the control is visible else false.

    Use hide() and show() to set visibility.

    Returns boolean

  • get type(): string
  • The type name for this control.
    (type name = class name without the Cvs prefix)

    Returns string

Methods

  • Add a child to this control using its relative position [rx, ry]. If rx and ry are not provided then it uses the values set in the child.

    Returns

    this control

    Parameters

    • c: string | CvsBaseControl

      is the actual control or its id

    • Optional rx: number
    • Optional ry: number

    Returns any

  • Get or set the corner radii used for this control.

    To set the radii the parameters must be one of the following

    • an array of 4 numbers.
    • a comma seperated list of 4 numbers.
    • a single number to be used for all 4 radii.

    If no parameter is passed or does not match one of the above then an array of the currently used radii values.

    Returns

    an array of the currently used radii values

    Parameters

    • Rest ...c: any

      valid radii combination

    Returns number[] | CvsBaseControl

  • Disables this control.

    Returns

    this control

    Parameters

    • Optional cascade: boolean

      if true disable child controls

    Returns CvsBaseControl

  • Enables this control.

    Returns

    this control

    Parameters

    • Optional cascade: boolean

      if true enable child controls

    Returns CvsBaseControl

  • Add this option to a named option-group.

    If the group doesn't exist then it will be created.

    Returns

    this control

    Parameters

    • optGroupName: string

    Returns CvsOption

  • Make this control invisible.

    Returns

    this control

    Parameters

    • Optional cascade: boolean

      if true hide children

    Returns CvsBaseControl

  • Gets or sets the icon and alignment relative to any text in the control.

    Processing constants are used to define the icon alignment.

    Returns

    this control or the current icon alignment

    Parameters

    • align: number

      LEFT or RIGHT

    Returns number | CvsOption

  • Returns

    true if this option selected else returns false

    Returns boolean

  • Remove this control from its parent

    Returns

    this control

    Returns CvsBaseControl

  • Move this control relative to current position.

    Returns

    this control

    Parameters

    • x: number

      horizontal distance

    • y: number

      vertical distance

    Returns CvsOption

  • Move this control to an absolute position.

    Returns

    this control

    Parameters

    • x: number

      horizontal position

    • y: number

      vertical position

    Returns CvsOption

  • Renoves any text that the control might use to display itself.

    Returns

    this control

    Returns CvsBaseControl

  • Makes the controls background opaque. The actual color depends on the controls color scheme.

    The second parameter, alpha, is optional and controls the level of opaqueness from 0 - transparent to 255 - fully opaque (efault value).

    Returns

    this control

    Parameters

    • alpha: number = 255

      alpha value for controls background color.

    Returns CvsBaseControl

  • Sets this controls display orientation to one of the four cardinal compass points. An invalid parameter will set the orientation to 'east' which is the default value.

    Returns

    this control

    Parameters

    • dir: string = 'east'

      'north', 'south', 'east' or 'west'

    Returns CvsBaseControl

  • Adds this control to another control which becomes its parent.

    Returns

    this control

    Parameters

    • parent: string | CvsBaseControl

      is the parental control or its id

    • Optional rx: number

      x position relative to parent

    • Optional ry: number

      y position relative to parent

    Returns CvsBaseControl

  • Remove a child control from this one so that it stays in same screen position.

    Returns

    this control

    Parameters

    Returns CvsOption

  • If the name of a valid color scheme is provided then it will use it to display the control, non-existant scheme names will be ignored. In both cases this control is returned.

    If there is no parameter it returns the name of the current color scheme used by this control.

    Returns

    this control or the control's color scheme

    Parameters

    • Optional name: string

      the color scheme name e.g. 'blue'

    • Optional cascade: boolean

      if true propogate scheme to all child controls.

    Returns ColorScheme | CvsBaseControl

  • Select this option, replacing the previos selection.

    Returns

    this control

    Returns CvsOption

  • This sets the event handler to be used when this control fires an event. The parameter can take one of three forms:

    1. Arrow function definition
    2. Anonymous function definition
    3. Named function declaration

    Returns

    this control

    Parameters

    • event_handler: Function

      the function to handle this control's events.

    Returns CvsOption

  • Make this control visible.

    Returns

    this control

    Parameters

    • Optional cascade: boolean

      if true show children

    Returns CvsBaseControl

  • Shrink the control to fit contents.

    To shrink on one dimension only pass either 'w' (width) or 'h' (height) to indicate which dimmension to shrink

    Returns

    this control

    Parameters

    • Optional dim: string

      the dimension to shrink

    Returns CvsBaseControl

  • Gets or sets the current text.

    Processing constants are used to define the alignment.

    Returns

    this control or the existing text

    Parameters

    • Optional t: string | string[]

      the text to display

    • Optional align: string

      LEFT, CENTER or RIGHT

    Returns string | CvsBaseControl

  • Sets the text alignment.

    Processing constants are used to define the text alignment.

    Returns

    this control

    Parameters

    • align: string

      LEFT, CENTER or RIGHT

    Returns CvsBaseControl

  • Sets or gets the text font for this control.

    If the parameter is true-type-font or the name of a system font it will be used as the local font and this control will be returned.

    Recognised font names are :-

    'arial'             'verdana'   'tahoma'        'trebuchet ms'
    'times new roman'   'georgia'   'courier new'   'brush script mt'
    'impact'            'serif'     'sans-serif'    'monospace'
    

    Invalid fonts are ignored and the local font is unchanged.

    If no parameter is passed then the current local font is returned.

    Returns

    this control

    Parameters

    • Optional ltf: any

      A true-type-font or the name (case-insensitive) of a valid system font.

    Returns string | GUI | CvsOption

  • Sets or gets the text size. If neccessary the control will expand to surround the text.

    Returns

    this control or the current text size

    Parameters

    • Optional lts: number

      the text size to use

    Returns number | GUI | CvsOption

  • Sets or gets the local text style.

    The 4 recognised font styles are :-

    NORMAL    BOLD   ITALIC   BOLDITALIC
    

    Unrecognized styles are ignored and the local style is unchanged.

    If no parameter is passed then the current style is returned.

    Returns

    this control

    Parameters

    • Optional gty: string

      the font style to use.

    Returns string | CvsOption

  • Sets the size of the text to use in the tooltip.

    Parameters

    • Optional tsize: number

      text size for this tooltip

    Returns CvsOption

  • Create a tooltip for this control.

    Returns

    this control

    Parameters

    • tiptext: string

      the text to appear in the tooltip

    Returns CvsOption

  • Makes the controls background fully transparent.

    Returns

    this control

    Returns CvsBaseControl

Generated using TypeDoc