win.checkWindow - WIN

Class checkWindow
Inherits from window.

The checkWindow class provides a check box and a string label with a height of 1 and width of the length of the label + 2. Its colors are initialized from the theme but may be customized after creation. A check_change event is sent to the parent with a first parameter of this check window object when its check state is changed by any means (programmatically or by the user).

To create a checkWindow use it's new method:
local chk = win.checkWindow:new (parent, id, x, y, label, checked)


Properties

check__checked boolean Holds the check state.
check__colors table Color table.
check__colors.text number Label text color.
check__colors.back number Label blurred background color.
check__colors.focus number Label focused background color.
check__colors.check_text number Check box text color.
check__colors.check_back number Check box blurred background color.
check__colors.check_focus number Check box focused background color.

Methods

See also API Reference, WIN.

win.checkWindow:constructor

check checkWindow:constructor (parent, id, x, y, label, checked)

Constructs and returns the instantiated check box window.

Parameters
parent window Parent window, typically a frame.
id number Numeric id value for check box window.
x number Parent relative x position.
y number Parent relative y position.
label string Check box label.
checked boolean Initial check state. Can be nil for unchecked.

Returns
check checkWindow The instantiated check box window.

Remarks


top


win.checkWindow:draw

checkWindow:draw (gdi, bounds)

Draws the check box control window.

Parameters
gdi GDI GDI object to use for drawing.
bounds rect Invalidated area of the window.

Returns
none


Remarks
See window:draw.


top


win.checkWindow:get_checked

checked checkWindow:get_checked ()

Returns the current check state of the check box control.

Parameters
none


Returns
checked boolean True if the check box is currently checked, false if not.

Remarks
See checkWindow:set_checked.


top


win.checkWindow:on_blur

result checkWindow:on_blur (focused)

Sets blurred background color.

Parameters
focused window The window gaining focus, it may be nil.

Returns
result boolean Always false.

Remarks
See window:on_blur.


top


win.checkWindow:on_focus

result checkWindow:on_focus (blurred)

Sets focused background color.

Parameters
blurred window The window losing focus, it may be nil.

Returns
result boolean Always false.

Remarks
See window:on_focus.


top


win.checkWindow:on_key

result checkWindow:on_key (key, ctrl, alt, shift)

Calls on_left_click handler on enter key.

Parameters
key number Key code.
ctrl boolean True if control key is depressed.
alt boolean True if alternate key is depressed.
shift boolean True if shift key is depressed.

Returns
result boolean True if handled, false if not.

Remarks
See window:on_key.


top


win.checkWindow:on_left_click

result checkWindow:on_left_click (x, y, count)

Calls the base implementation and toggles the check state of the check box control.

Parameters
x number Window relative x position.
y number Window relative y position.
count
number The number of times this same position was repeatedly clicked, with each successive click within the double_click_time.

Returns
result boolean Always true.

Remarks
A check_change event is sent to the parent window.

See window:on_left_click.


top


win.checkWindow:on_touch

result checkWindow:on_touch (x, y)

Calls the base implementation and toggles the check state of the check box control.

Parameters
x number Window relative x position.
y number Window relative y position.

Returns
result boolean Always true.

Remarks
A check_change event is sent to the parent window.

See window:on_touch.


top


win.checkWindow:set_checked

checkWindow:set_checked (check)

Sets the check state of the check box.

Parameters
checked boolean True to set the check box as checked, false for not.

Returns
none


Remarks
A check_change event is sent to the parent window if the check state is changed.

The window is invalidated.

See checkWindow:get_checked.


top


win.checkWindow:set_colors

checkWindow:set_colors (text, background, focus, check_text, check_back, check_focus)

Sets the colours for the check box control.

Parameters
text number Label text color.
background number Label blurred background color.
focus number Label focused background color.
check_text number Check box text color.
check_back number Check box blurred background color.
check_focus number Check box focused background color.

Returns
none


Remarks
Invalidation is handled.


top


See also API Reference, WIN.