SetCheckBox

Description

Sets the check box for the RibbonBar control.

Applies to

RibbonBar controls

Syntax

controlname.SetCheckBox ( Long ItemHandle, RibbonCheckBoxItem Item )

Argument

Description

controlname

The name of the RibbonBar control.

ItemHandle

The handle of the item (check box, combo box, large button, small button, group) on the same level that you will set the item.

Item

A check box item you are setting.


Return value

Integer.

Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is null, returns null.

Usage

You can also use the SetItem function to set the check box. Refer to SetItem for the difference between SetItem and SetCheckBox.

The user events to be bound with the check box must be defined correctly according to the requirements of RibbonCheckBoxItem. For details, see Clicked and Selected.

Examples

This example inserts the "MyCheckBox1" check box and binds it with the "Ue_CheckBoxClicked" user event, and then changes the check box text from "MyCheckBox1" to "MyCheckBox2", and changes the bound user events from "Ue_CheckBoxClicked" to "Ue_CheckBoxClicked2" and "Ue_CheckBoxSelected2".

Integer li_Return
Long ll_Handle_Category, ll_Handle_Panel, ll_Handle_CheckBox
RibbonCheckBoxItem lr_CheckBox

ll_Handle_Category = rbb_1.InsertCategoryFirst ("MyCategory")
ll_Handle_Panel = rbb_1.InsertPanelFirst (ll_Handle_Category, "MyPanel", "AddSmall!")
ll_Handle_CheckBox = rbb_1.InsertCheckBoxFirst (ll_Handle_Panel, "MyCheckBox1", "Ue_CheckBoxClicked")
li_Return = rbb_1.GetChildItemByIndex (ll_Handle_Panel, 1, lr_CheckBox)
If li_Return = 1 Then
 lr_CheckBox.Text = "MyCheckBox2"
 lr_CheckBox.Clicked = "Ue_CheckBoxClicked2"
 lr_CheckBox.Selected = "Ue_CheckBoxSelected2"
 li_Return = rbb_1.SetCheckBox (lr_CheckBox.ItemHandle, lr_CheckBox)
End If

See also

InsertCheckBox

InsertCheckBoxFirst

InsertCheckBoxLast

DeleteCheckBox

GetCheckBox

GetChildItemByIndex