Class: Fox::FXCheckButton

Inherits:
FXLabel show all
Defined in:
rdoc-sources/FXCheckButton.rb,
lib/fox16/core.rb

Overview

A Check button is a tri-state button. Normally, it is either TRUE or FALSE, and toggles between TRUE or FALSE whenever it is pressed. A third state MAYBE may be set to indicate that no selection has been made yet by the user, or that the state is ambiguous. When pressed, the Check Button sends a SEL_COMMAND to its target, and the message data represents the state of the check button. The option CHECKBUTTON_AUTOGRAY (CHECKBUTTON_AUTOHIDE) causes the button to be grayed out (hidden) if its handler does not respond to the SEL_UPDATE message. With the CHECKBUTTON_PLUS option, the Check Button will draw a + or - sign instead of a check. You can use this to make collapsible panels, by hooking up a Check Button to a layout manager via the ID_TOGGLE_SHOWN message. This will give a similar visual element as collapsing folders in a Tree List.

Events

The following messages are sent by FXCheckButton to its target:

SEL_KEYPRESS

sent when a key goes down; the message data is an FXEvent instance.

SEL_KEYRELEASE

sent when a key goes up; the message data is an FXEvent instance.

SEL_LEFTBUTTONPRESS

sent when the left mouse button goes down; the message data is an FXEvent instance.

SEL_LEFTBUTTONRELEASE

sent when the left mouse button goes up; the message data is an FXEvent instance.

SEL_COMMAND

sent when the button is clicked.

CheckButton styles

CHECKBUTTON_AUTOGRAY

Automatically gray out when not updated

CHECKBUTTON_AUTOHIDE

Automatically hide when not updated

CHECKBUTTON_PLUS

Draw a plus sign for unchecked and minus sign for checked

CHECKBUTTON_NORMAL

JUSTIFY_NORMAL|ICON_BEFORE_TEXT

Instance Attribute Summary collapse

Attributes inherited from FXLabel

#font, #helpText, #icon, #iconPosition, #justify, #text, #textColor, #tipText

Attributes inherited from FXFrame

#baseColor, #borderColor, #borderWidth, #frameStyle, #hiliteColor, #padBottom, #padLeft, #padRight, #padTop, #shadowColor

Attributes inherited from FXWindow

#accelTable, #backColor, #defaultCursor, #dragCursor, #first, #focus, #key, #last, #layoutHints, #next, #numChildren, #owner, #parent, #prev, #root, #selector, #shell, #target, #x, #y

Attributes inherited from FXDrawable

#height, #visual, #width

Attributes inherited from FXId

#app, #userData, #xid

Instance Method Summary collapse

Methods inherited from FXLabel

#to_s

Methods inherited from FXWindow

#acceptDrop, #acquireClipboard, #acquireSelection, #active?, #addHotKey, after?, #after?, before?, #before?, #beginDrag, #canFocus?, #changeFocus, #childAtIndex, #childOf?, #children, #clearDragRectangle, #clearShape, colorType, colorTypeName, commonAncestor, #composeContext, #composite?, #contains?, #containsChild?, #create, #createComposeContext, #cursorPosition, #default?, #defaultHeight, #defaultWidth, deleteType, deleteTypeName, #destroy, #destroyComposeContext, #detach, #didAccept, #disable, #doesSaveUnder?, #dragging?, #dropDisable, #dropEnable, #dropEnabled?, #dropFinished, #dropTarget?, #each_child, #each_child_recursive, #enable, #enabled?, #endDrag, #forceRefresh, #getChildAt, #getDNDData, #getHeightForWidth, #getWidthForHeight, #grab, #grabKeyboard, #grabbed?, #grabbedKeyboard?, #handleDrag, #hasClipboard?, #hasFocus?, #hasSelection?, #height, #height=, #hide, imageType, #inFocusChain?, #indexOfChild, #initial?, #inquireDNDAction, #inquireDNDTypes, #killFocus, #layout, #linkAfter, #linkBefore, #lower, #move, octetType, octetTypeName, #offeredDNDType?, #position, #raiseWindow, #recalc, #releaseClipboard, #releaseSelection, #remHotKey, #removeChild, #repaint, #reparent, #resize, #scroll, #setCursorPosition, #setDNDData, #setDefault, #setDragRectangle, #setFocus, #setInitial, #setShape, #shell?, #show, #shown?, stringType, textType, textTypeName, #tr, #translateCoordinatesFrom, #translateCoordinatesTo, #underCursor?, #ungrab, #ungrabKeyboard, #update, urilistType, urilistTypeName, utf16Type, utf16TypeName, utf8Type, utf8TypeName, #visible=, #width, #width=

Methods included from Responder2

#connect

Methods inherited from FXDrawable

#resize

Methods inherited from FXId

#create, #created?, #destroy, #detach, #runOnUiThread

Methods inherited from FXObject

#bind, #handle, #load, #save, subclasses

Constructor Details

#initialize(parent, text, target = nil, selector = 0, opts = CHECKBUTTON_NORMAL, x = 0, y = 0, width = 0, height = 0, padLeft = DEFAULT_PAD, padRight = DEFAULT_PAD, padTop = DEFAULT_PAD, padBottom = DEFAULT_PAD) ⇒ FXCheckButton

Construct new check button


48
49
# File 'rdoc-sources/FXCheckButton.rb', line 48

def initialize(parent, text, target=nil, selector=0, opts=CHECKBUTTON_NORMAL, x=0, y=0, width=0, height=0, padLeft=DEFAULT_PAD, padRight=DEFAULT_PAD, padTop=DEFAULT_PAD, padBottom=DEFAULT_PAD) # :yields: theCheckButton
end

Instance Attribute Details

#boxColorObject

Box background color Fox::FXColor


42
43
44
# File 'rdoc-sources/FXCheckButton.rb', line 42

def boxColor
  @boxColor
end

#checkButtonStyleObject

Check button style [Integer]


39
40
41
# File 'rdoc-sources/FXCheckButton.rb', line 39

def checkButtonStyle
  @checkButtonStyle
end

#checkColorObject

Box check color Fox::FXColor


45
46
47
# File 'rdoc-sources/FXCheckButton.rb', line 45

def checkColor
  @checkColor
end

#checkStateObject

Check button state (TRUE, FALSE or MAYBE) [Integer]


36
37
38
# File 'rdoc-sources/FXCheckButton.rb', line 36

def checkState
  @checkState
end

Instance Method Details

#checked?Boolean

Return true if this check button is in the checked state.

Returns:

  • (Boolean)

472
473
474
# File 'lib/fox16/core.rb', line 472

def checked?
  self.checkState == TRUE
end

#maybe?Boolean

Return true if this check button is in the indeterminate, or “maybe”, state.

Returns:

  • (Boolean)

482
483
484
# File 'lib/fox16/core.rb', line 482

def maybe?
  self.checkState == MAYBE
end

#setCheck(state, notify = false) ⇒ Object

Set the check button state to one of TRUE, FALSE or MAYBE. If notify is true, send a SEL_COMMAND message to the message target after the state has been updated.


56
# File 'rdoc-sources/FXCheckButton.rb', line 56

def setCheck(state, notify=false); end

#unchecked?Boolean

Return true if this check button is in the unchecked state.

Returns:

  • (Boolean)

477
478
479
# File 'lib/fox16/core.rb', line 477

def unchecked?
  self.checkState == FALSE
end