InsertComboBox

Description

Inserts a combo box in the panel or group of the RibbonBar control.

Applies to

RibbonBar controls

Syntax

controlname.InsertComboBox ( Long ParentHandle, Long ItemHandleAfter, String SelectionChanged )
controlname.InsertComboBox ( Long ParentHandle, Long ItemHandleAfter, RibbonComboBoxItem Item )

Argument

Description

controlname

The name of the RibbonBar control.

ParentHandle

The handle of the panel or group into which you want to insert a combo box.

ItemHandleAfter

The handle of the item (check box, combo box, large button, small button, or group) on the same level after which you want to insert the combo box.

SelectionChanged

The name of the SelectionChanged user event to be bound with the combo box. The SelectionChanged user event for the combo box must have two long parameters for receiving the handle and index number of the combo box. For details, see SelectionChanged.

Item

A combo box item to be inserted.


Return value

Long.

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

Usage

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.

Example 1

This example inserts a combo box after another combo box in a panel. Both combo boxes are bound with the "Ue_ComboBoxSelectionChanged" user event.

Long ll_Handle_Category, ll_Handle_Panel, ll_Handle_ComboBox, ll_Handle_ComboBox2

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_ComboBoxSelectionChanged")
ll_Handle_ComboBox2 = rbb_1.InsertComboBox (ll_Handle_Panel, ll_Handle_ComboBox, "Ue_ComboBoxSelectionChanged")

//Ue_ComboBoxSelectionChanged user event must have two long parameters for receiving the handle and 
//index number of the selected ComboBox.
//event type long ue_comboboxselectionchanged(long itemhandle, long index);
//Integer li_Return
//String ls_Text
//
//RibbonComboBoxItem lr_ComboBox
//li_Return = rbb_1.GetComboBox(ItemHandle,lr_ComboBox)
//If li_Return = 1 Then
// ls_Text = lr_ComboBox.Text(Index)
//End If
//
//Return 1
//end event

Example 2

This example inserts the "MyComboBox2" combo box after another combo box in a panel and binds it with "Ue_ComboBoxSelectionChanged", "Ue_ComboBoxSelected" and "Ue_ComboBoxModified" user events. It first defines a combo box item with various properties (including Label, PictureName, SelectionChanged, Selected, Modified etc.) and then inserts it after another combo box.

Long ll_Handle_Category, ll_Handle_Panel, ll_Handle_ComboBox, ll_Handle_ComboBox2
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_ComboBoxSelectionChanged")
lr_ComboBox.Label = "MyComboBox2"
lr_ComboBox.PictureName = "HelpSmall!"
lr_ComboBox.SelectionChanged = "Ue_ComboBoxSelectionChanged"
lr_ComboBox.Selected = "Ue_ComboBoxSelected"
lr_ComboBox.Modified = "Ue_ComboBoxModified"
ll_Handle_ComboBox2 = rbb_1.InsertComboBox (ll_Handle_Panel, ll_Handle_ComboBox, lr_ComboBox)

//Ue_ComboBoxModified user event must have a long parameter for receiving the handle
//of ComboBox that is changed.
//event type long ue_comboboxmodified(long itemhandle);
//RibbonComboBoxItem lr_ComboBox
//rbb_1.GetComboBox(ItemHandle,lr_ComboBox)
////...
//
//return 1
//end event

//Ue_ComboBoxSelected user event must have a long parameter for receiving the handle 
//of ComboBox where the mouse is hovering over.
//event type long ue_comboboxselected(long itemhandle);
//RibbonComboBoxItem lr_ComboBox
//rbb_1.GetComboBox(ItemHandle,lr_ComboBox)
////...
//
//return 1
//end event

See also

InsertComboBoxFirst

InsertComboBoxLast

DeleteComboBox

SetComboBox

GetComboBox

GetChildItemByIndex