CheckBox Ocx

Purpose

Creates an Ocx CheckBox control in the current active form, window, or dialog.

Syntax

Ocx CheckBox name = text$ [, id], x, y, b, h [, style%]

text$:control text
id%:control identifier
x, y, b, h:iexp
style%:the control styles

Description

A CheckBox control displays an X when selected; the X disappears when the CheckBox is cleared. Use this control to give the user a True/False or Yes/No option. You can use CheckBox controls in groups to display multiple choices from which the user can select one or more. You can also set the value of a CheckBox programmatically with the Value property.

The CheckBox Ocx control has the following properties, methods, and events.

Properties

Align | Appearance | Caption | Enabled | Font | FontBold | FontItalic | FontStrikethru | FontUnderline | FontName | FontSize | Height | HelpContextID | hWnd | Index | Left | Top | MouseCursor | MouseIcon | MousePointer | Name | Picture | PushLike | TabStop | Tag | Text | ThreeState | ToolTiptext | Value | Visible | WhatsThisHelpID | Width | WinStyle

One additional property of Checkboxes not included above is the ability to switch the position of the text from being on the right hand side of the checkbox (the default) to the left. This is done using the BS_LEFTTEXT (or BS_RIGHTBUTTON) property as follows:

Ocx CheckBox chk = "This is to the left", 10, 10, 200, 15

chk.WinStyle = chk.WinStyle | BS_LEFTTEXT

Do : Sleep : Until Me Is Nothing

Methods

DoClick | Move | Refresh | SetFocus | SetFont | TextHeight | TextWidth | ZOrder

Events

Click | DblClick | GotFocus | LostFocus | KeyDown | KeyUp | KeyPress | MouseDown | MouseUp | MouseMove

Remarks

CheckBox and OptionButton controls function similarly but with an important difference: Any number of CheckBox controls on a form can be selected at the same time. In contrast, only one OptionButton in a group can be selected at any given time.

To display text next to the CheckBox, set the Caption property. Use the Value property to determine the state of the control-selected, cleared, or unavailable.

See Also

Ocx, OcxOcx

Animation, CheckBox, ComboBox, Command, CommDlg, Form, Frame, Image, ImageList, Label, ListBox, ListView, MonthView, Option, ProgressBar, RichEdit, Scroll, Slider, StatusBar, TabStrip, TextBox, Timer, TrayIcon, TreeView, UpDown

{Created by Sjouke Hamstra; Last updated: 06/03/2022 by James Gaite}