Index

## Global Objects

- rap
- SWT

## Types

- Button
- Canvas
- Combo
- Composite
- Control
- Event
- Label
- ProgressBar
- RemoteObject
- Scale
- Spinner
- Text

# Type Control

RWT Scripting analoge to org.eclipse.swt.widgets.Control

Type Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| Control() The constructor is not public.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| forceFocus() Forces the receiver to have the keyboard focus, causing all keyboard events to be delivered to it.
| getBackground() Returns the receiver's background color.
| getCursor() Returns the receiver's cursor, or null if it has not been set.
| getData(property) Returns the application defined property of the receiver with the specified name, or null if it has not been set.
| getEnabled() Returns `true` if the receiver is enabled, and `false` otherwise.
| getForeground() Returns the receiver's foreground color.
| getToolTipText() Returns the receiver's tool tip text, or null if it has not been set.
| getVisible() Returns `true` if the receiver is visible, and `false` otherwise.
| setBackground(color) Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.
| setData(property, value) Sets the application defined property of the receiver with the specified name to the given value.
| setEnabled(enabled) Enables the receiver if the argument is `true`, and disables it otherwise.
| setForeground(color) Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.
| setToolTipText(toolTipText) Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown.
| setVisible(visible) Marks the receiver as visible if the argument is `true`, and marks it invisible otherwise.

Type Detail
Control()
The constructor is not public.

Since:
  2.2

Method Detail
{boolean} forceFocus()
Forces the receiver to have the keyboard focus, causing all keyboard events to be delivered to it.

Returns:
  {boolean} `true` if the control got focus, and `false` if it was unable to.

{int[]} getBackground()
Returns the receiver's background color.

Returns:
  {int[]} the background color as array [ red, green, blue ]

{string|null} getCursor()
Returns the receiver's cursor, or null if it has not been set.

When the mouse pointer passes over a control its appearance is changed to match the control's cursor.

All possible values are available as constants on the SWT object.

Returns:
  {string|null} the receiver's cursor or `null`

{var} getData(property)
Returns the application defined property of the receiver with the specified name, or null if it has not been set.

The java widget properties can be accessed if the property name was registered with WidgetUtil.registerDataKeys.

Parameters:
{string} property
  the name of the property

Returns:
  {var} the value

See:
  Control#setData

{boolean} getEnabled()
Returns `true` if the receiver is enabled, and `false` otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.

Returns:
  {boolean} the receiver's enabled state

{int[]} getForeground()
Returns the receiver's foreground color.

Returns:
  {int[]} the foreground color as array [ red, green, blue ]

{string|null} getToolTipText()
Returns the receiver's tool tip text, or null if it has not been set.

Returns:
  {string|null} the receiver's tool tip text

{boolean} getVisible()
Returns `true` if the receiver is visible, and `false` otherwise.

If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing.

Returns:
  {boolean} the receiver's visibility state

setBackground(color)
Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.

Parameters:
{int[]|null} color
  the new color as array [ red, green, blue ] or null

setData(property, value)
Sets the application defined property of the receiver with the specified name to the given value.

The java widget is not affected by this method, but can itself set this object's properties if the name was registered with WidgetUtil.registerDataKeys.

Parameters:
{string} property
  the name of the property
{var} value
  the new value for the property

See:
  Control#getData

setEnabled(enabled)
Enables the receiver if the argument is `true`, and disables it otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.

Parameters:
{boolean} enabled
  the new enabled state

setForeground(color)
Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.

Parameters:
{int[]|null} color
  the new color as array [ red, green, blue ] or null

setToolTipText(toolTipText)
Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown.

Parameters:
{string|null} toolTipText
  the new tool tip text (or null)

setVisible(visible)
Marks the receiver as visible if the argument is `true`, and marks it invisible otherwise.

If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking it visible may not actually cause it to be displayed.

NOTE: If there is a `Show` or `Hide` Java listener attached to this widget, it may be notified at a later point in time. `ClientListener` are notified right away.

Parameters:
{boolean} visible
  the new visibility state

Copyright (c) EclipseSource and others 2013. All rights reserved.