Index

Global Objects

Types


Type Control


Extends Widget.
RWT Scripting analog to org.eclipse.swt.widgets.Control. All controls given by rap.getObject are instances of this type, even if their specific subtype is not documented.

Fields borrowed from class Widget:
$el
Method Summary
Method Attributes Method Name and Description
 
addListener(type, listener)
Register the function as a listener of the given type
 
Forces the receiver to have the keyboard focus, causing all keyboard events to be delivered to it.
 
Returns the receiver's background color.
 
Returns the receiver's cursor, or null if it has not been set.
 
Returns true if the receiver is enabled, and false otherwise.
 
Returns the receiver's foreground color.
 
Returns the receiver's tool tip text, or null if it has not been set.
 
Returns true if the receiver is visible, and false otherwise.
 
removeListener(type, listener)
De-register the function as a listener of the given type
 
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.
 
setEnabled(enabled)
Enables the receiver if the argument is true, and disables it otherwise.
 
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.
Methods borrowed from class Widget:
getData, setData
Event Summary
Event Attributes Event Name and Description
 
Sent when the widget gains focus
 
Sent when the widget looses focus
 
Sent when the widget is hidden
 
Sent when a key is pressed
 
Sent when a key is released
 
Sent when a mouse button is clicked twice
 
Sent when a mouse button is pressed
 
Sent when the mouse pointer enters the widget
 
Sent when the mouse pointer exits the widget
 
Sent when the mouse pointer is moved
 
Sent when a mouse button is released
 
Sent when the mouse wheel is moved
 
Sent when the widget is painted
 
Sent when the widget appears
Type Detail
<private> Control()
The constructor is not public.
Since:
2.2
Method Detail
addListener(type, listener)
Register the function as a listener of the given type
Parameters:
{string} type
The type of the event (e.g. SWT.Resize).
{Function} listener
The callback function. It is executed in global context.

{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

{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

removeListener(type, listener)
De-register the function as a listener of the given type
Parameters:
{string} type
The type of the event (e.g. SWT.Resize).
{Function} listener
The callback function

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

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
Event Detail
FocusIn
Sent when the widget gains focus
Parameters:
{Event} event
See:
SWT.FocusIn

FocusOut
Sent when the widget looses focus
Parameters:
{Event} event
See:
SWT.FocusOut

Hide
Sent when the widget is hidden
Parameters:
{Event} event
See:
SWT.Hide

KeyDown
Sent when a key is pressed
Parameters:
{Event} event
See:
SWT.KeyDown

KeyUp
Sent when a key is released
Parameters:
{Event} event
See:
SWT.KeyUp

MouseDoubleClick
Sent when a mouse button is clicked twice
Parameters:
{Event} event
See:
SWT.MouseDoubleClick

MouseDown
Sent when a mouse button is pressed
Parameters:
{Event} event
See:
SWT.MouseDown

MouseEnter
Sent when the mouse pointer enters the widget
Parameters:
{Event} event
See:
SWT.MouseEnter

MouseExit
Sent when the mouse pointer exits the widget
Parameters:
{Event} event
See:
SWT.MouseExit

MouseMove
Sent when the mouse pointer is moved
Parameters:
{Event} event
See:
SWT.MouseMove

MouseUp
Sent when a mouse button is released
Parameters:
{Event} event
See:
SWT.MouseUp

MouseWheel
Sent when the mouse wheel is moved
Parameters:
{Event} event
See:
SWT.MouseWheel

Paint
Sent when the widget is painted
Parameters:
{Event} event
See:
SWT.Paint

Show
Sent when the widget appears
Parameters:
{Event} event
See:
SWT.Show

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