WebCheckBox

From Xojo Documentation


For desktop applications, see Checkbox.

Class (inherits from WebControl)


New in 2010r4

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

Events
Close KeyPressed MouseUp
ContextualMenuAction LostFocus Open
DoubleClick MouseDown Resized
DropObject MouseEnter Shown
GotFocus MouseExit ValueChanged
Hidden MouseMove
Properties
Caption Left Parent fa-lock-32.png
ContextualMenu LockBottom Style
ControlID fa-lock-32.png LockHorizontal Top
Cursor LockLeft Value
DragOverStyle LockRight VerticalCenter
Enabled LockTop Visible
Height LockVertical Width
HelpTag Name fa-lock-32.png Zindex
HorizontalCenter Page fa-lock-32.png
Methods
AcceptPictureDrop AllowRawDataDrag MsgBox
AcceptRawDataDrop AllowTextDrag PresentContextualMenu
AcceptTextDrop Close SetFocus
AllowPictureDrag ExecuteJavaScript ShowURL

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