Class: Fox::FXRadioButton

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

Overview

A radio button is a tri-state button. Normally, it is either TRUE or FALSE; 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 radio button sets its state to TRUE and sends a SEL_COMMAND message to its target, with the message data set to the state of the radio button. A group of radio buttons can be made mutually exclusive by linking them to a common data target (i.e. an instance of FXDataTarget). Alternatively, an application can implement a common SEL_UPDATE handler to check and uncheck radio buttons as appropriate.

Events

The following messages are sent by FXRadioButton to its target:

SEL_COMMAND

sent when the radio button is pressed.

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.

RadioButton flags

RADIOBUTTON_AUTOGRAY

Automatically gray out when not updated

RADIOBUTTON_AUTOHIDE

Automatically hide when not updated

RADIOBUTTON_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 = RADIOBUTTON_NORMAL, x = 0, y = 0, width = 0, height = 0, padLeft = DEFAULT_PAD, padRight = DEFAULT_PAD, padTop = DEFAULT_PAD, padBottom = DEFAULT_PAD) ⇒ FXRadioButton

Construct new radio button



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

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

Instance Attribute Details

#checkStateObject

Radio button state, one of TRUE, FALSE or MAYBE [Integer]



32
33
34
# File 'rdoc-sources/FXRadioButton.rb', line 32

def checkState
  @checkState
end

#diskColorObject

Radio disk color Fox::FXColor



41
42
43
# File 'rdoc-sources/FXRadioButton.rb', line 41

def diskColor
  @diskColor
end

#radioButtonStyleObject

Radio button style [Integer]



35
36
37
# File 'rdoc-sources/FXRadioButton.rb', line 35

def radioButtonStyle
  @radioButtonStyle
end

#radioColorObject

Radio ball color Fox::FXColor



38
39
40
# File 'rdoc-sources/FXRadioButton.rb', line 38

def radioColor
  @radioColor
end

Instance Method Details

#checked?Boolean

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

Returns:

  • (Boolean)


52
53
54
# File 'rdoc-sources/FXRadioButton.rb', line 52

def checked?
  self.checkState == Fox::TRUE
end

#maybe?Boolean

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

Returns:

  • (Boolean)


66
67
68
# File 'rdoc-sources/FXRadioButton.rb', line 66

def maybe?
  self.checkState == Fox::MAYBE
end

#unchecked?Boolean

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

Returns:

  • (Boolean)


59
60
61
# File 'rdoc-sources/FXRadioButton.rb', line 59

def unchecked?
  self.checkState == Fox::FALSE
end