Syntax 5: For RibbonBar controls
Description
Sets the item control in the RibbonBar.
Applies to
Syntax 1
|
1 |
controlname.SetItem ( Long ItemHandle, PowerObject Item ) |
Syntax 2
|
1 |
controlname.SetItem ( PowerObject Item ) |
|
Argument |
Description |
|---|---|
|
controlname |
The name of the RibbonBar control in which you want to |
|
ItemHandle |
The handle of the item which you want to set. |
|
Item |
The object of type PowerObject containing information |
Usage
This function can be used to set items including
ApplicationButton, TabButton, Category, Panel, Group, CheckBox,
ComboBox, LargeButton, and SmallButton; but cannot set RibbonMenuItem,
RibbonApplicationMenu, and RibbonMenu. To set RibbonMenuItem, you can
use the SetItem Syntax 4, SetMasterItem, and SetRecentItem functions. To set
RibbonApplicationMenu and RibbonMenu, you can use the SetMenu function.
You can also use the following functions to set the individual
control: SetApplicationButton, SetCategory, SetCheckBox, SetComboBox, SetGroup, SetLargeButton, SetPanel, SetSmallButton, and SetTabButton. For example, the
following three statements have the same effect:
This statement is the simplest, and does not require the item
handle; but it needs to convert the object type from PowerObject to
RibbonCheckBoxItem:
|
1 |
rbb_1.SetItem (lr_CheckBox) |
This statement requires the item handle and it needs to convert
the object type from PowerObject to RibbonCheckBoxItem:
|
1 |
rbb_1.SetItem (lr_CheckBox.itemhandle, lr_CheckBox) |
This statement requires the item handle but it does not need to
convert the object type:
|
1 |
rbb_1.SetCheckBox (lr_CheckBox.itemhandle, lr_CheckBox) |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs. If any
argument’s value is null, returns null.
Example 1
This example inserts two tab buttons and then sets the value of
the Enabled property of the first tab button.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Long ll_TabCount, ll_i Integer li_return RibbonTabButtonItem lr_Tab rbb_1.InsertTabButtonFirst("TabButton1", "ArrowUpSmall!", "ue_TabButtonClicked") rbb_1.InsertTabButtonLast("TabButton2", "HelpSmall!", "ue_TabButtonClicked") ll_TabCount = Rbb_1.GetTabbuttoncount( ) For ll_I = 1 To ll_TabCount If rbb_1.Gettabbuttonbyindex(ll_I, lr_Tab) = 1 Then If lr_Tab.Enabled Then lr_Tab.Enabled = False Else lr_Tab.Enabled = True End If li_return = rbb_1.SetItem(lr_Tab.itemhandle, lr_Tab) End If Next |
Example 2
This example sets the value of the Tag property of the button (a
small button or a large button) being clicked.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
//Event ue_buttonclicked (long itemhandle) PowerObject lpo_Object RibbonSmallButtonItem lr_SmallButton RibbonLargeButtonItem lr_LargeButton Integer li_Return, li_Return2 li_Return = rbb_1.GetItem(Itemhandle, lpo_Object) If li_Return = 1 Then Choose Case lpo_Object.ClassName() Case "ribbonsmallbuttonitem" lr_SmallButton = lpo_Object lr_SmallButton.Tag = "SmallButton Clicked" li_Return2 = rbb_1.SetItem(lr_SmallButton) Case "ribbonlargebuttonitem" lr_LargeButton = lpo_Object lr_LargeButton.Tag = "LargeButton Clicked" li_Return2 = rbb_1.SetItem(lr_LargeButton) End Choose End If |