WebCheckBox

From Xojo Documentation

Class (inherits from WebUIControl)


New in 2010r4

The standard checkbox used by web apps. This checkbox itself of this control is implemented as a native browser control.

Events
Closed Hidden Shown
ContextualMenuSelected Opening ValueChanged
Properties
Caption LockBottom fa-lock-32.png Style
ContextualMenu LockHorizontal fa-lock-32.png TabIndex
ControlID fa-lock-32.png LockLeft fa-lock-32.png Tooltip
Enabled LockRight fa-lock-32.png Top
Height LockVertical fa-lock-32.png Value
Indeterminate Name fa-lock-32.png Visible
Indicator Page fa-lock-32.png Width
Left Parent fa-lock-32.png
Methods
Close GotoURL UpdateBrowser
ExecuteJavaScript SetFocus

Sample Code

Test to see if the user has checked the CheckBox:

If CheckBox1.Value Then
MsgBox("Checked!")
End If

You can also check the CheckBox in your code:

CheckBox1.Value = True

See the ControlWithName example in the Examples folder for an example of togglng a checkbox using the WebView.ControlWithName method. It uses ControlWithName in the following way.

Var cb As WebCheckbox
cb = WebCheckbox(Self.ControlWithName("Checkbox" + TextField1.Text))
If cb = Nil Then
MsgBox("There is no checkbox with the name: Checkbox" + TextField1.Text)
Else
cb.Value = Not cb.Value
End If

The TextField1 control contains a valid number, so the method is able to toggle that checkbox.

See Also

Checkbox, WebRadioGroup, WebPopupMenu classes; UserGuide:Web Check Box topic