SetComboBox

Description

Sets the combo box for the RibbonBar control.

Applies to

RibbonBar control

Syntax

controlname.SetComboBox ( Long ItemHandle, RibbonComboBoxItem 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 combo 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 combo box. Refer to SetItem for the difference between SetItem and SetComboBox.

The user events to be bound with the combo box must be defined correctly according to the requirements of RibbonComboBoxItem. For details, see Modified, Selected, and SelectionChanged.

Examples

This example inserts a combo box and binds it with the "Ue_ComboBoxClicked" user event, and then sets values for various properties (including Label, PictureName, SelectionChanged, Selected, Modified etc.) of the combo box.

Integer li_Return
Long ll_Handle_Category, ll_Handle_Panel, ll_Handle_ComboBox
RibbonComboBoxItem lr_ComboBox

ll_Handle_Category = rbb_1.InsertCategoryFirst ("MyCategory")
ll_Handle_Panel = rbb_1.InsertPanelFirst (ll_Handle_Category, "MyPanel", "AddSmall!")
ll_Handle_ComboBox = rbb_1.InsertComboBoxFirst (ll_Handle_Panel, "Ue_ComboBoxClicked")
li_Return = rbb_1.GetChildItemByIndex (ll_Handle_Panel, 1, lr_ComboBox)
If li_Return = 1 Then
 lr_ComboBox.Label = "MyComboBox2"
 lr_ComboBox.PictureName = "HelpSmall!"
 lr_ComboBox.SelectionChanged = "Ue_ComboBoxSelectionChanged"
 lr_ComboBox.Selected = "Ue_ComboBoxSelected"
 lr_ComboBox.Modified = "Ue_ComboBoxModified"
 li_Return = rbb_1.SetComboBox (lr_ComboBox.ItemHandle, lr_ComboBox)
End If

See also

InsertComboBox

InsertComboBoxFirst

InsertComboBoxLast

DeleteComboBox

GetComboBox

GetChildItemByIndex