InsertSmallButton
PowerScript function
Description
Inserts a small button in the panel or group of the RibbonBar
control.
Applies to
RibbonBar controls
Syntax
|
1 |
controlname.InsertSmallButton (Long ParentHandle, Long ItemHandleAfter, String Text, String PictureName, String Clicked ) |
|
1 |
controlname.InsertSmallButton (Long ParentHandle, Long ItemHandleAfter, RibbonSmallButtonItem Item ) |
|
Argument |
Description |
|---|---|
|
controlname |
The name of the RibbonBar control. |
|
ParentHandle |
The handle of the panel or group into which you want to |
|
ItemHandleAfter |
The handle of the item (check box, combo box, large |
|
Text |
The text that displays in the small button. |
|
PictureName |
The name of the file that contains the picture. It will be |
|
Clicked |
The name of the Clicked user event to be bound with the |
|
Item |
A small button item you want to insert. |
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 small button must be defined
correctly according to the requirements of RibbonSmallButtonItem. For
details, see Clicked in PowerScript Reference and Selected in PowerScript Reference.
Example 1
This example inserts a “Delete” small button after the “Add” small
button in the “MyPanel” panel. Both buttons are bound with the
“Ue_SmallButtonClicked” user event.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Long ll_Handle_Category, ll_Handle_Panel, ll_Handle_SmallButton, ll_Handle_SmallButton2 ll_Handle_Category = rbb_1.InsertCategoryFirst ("MyCategory") ll_Handle_Panel = rbb_1.InsertPanelFirst (ll_Handle_Category, "MyPanel", "AddSmall!") ll_Handle_SmallButton = rbb_1.InsertSmallButtonFirst (ll_Handle_Panel, "Add", "AddSmall!", "Ue_SmallButtonClicked") ll_Handle_SmallButton2 = rbb_1.InsertSmallButton (ll_Handle_Panel, ll_Handle_SmallButton, "Delete", "DeleteSmall!", "Ue_SmallButtonClicked") //Ue_SmallButtonClicked user event must have a long parameter for receiving the handle //of SmallButton where the mouse is clicking. Refer to the Clicked property of RibbonSmallButtonItem. //event type long ue_smallbuttonclicked(long itemhandle); //RibbonSmallButtonItem lr_SmallButton //rbb_1.GetSmallButton(ItemHandle,lr_SmallButton) ////... // //Return 1 //end event |
Example 2
This example inserts a “Delete” small button after the “Add” small
button in the “MyPanel” panel and binds the “Delete” button with the
“Ue_SmallButtonClicked” and “Ue_SmallButtonSelected” user events. It first
defines a small button item with various properties (including Text,
PictureName, Clicked, Selected etc.) and then inserts it after the “Add’
small button.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
Long ll_Handle_Category, ll_Handle_Panel, ll_Handle_SmallButton, ll_Handle_SmallButton2 RibbonSmallButtonItem lr_SmallButton ll_Handle_Category = rbb_1.InsertCategoryFirst("MyCategory") ll_Handle_Panel = rbb_1.InsertPanelFirst(ll_Handle_Category, "MyPanel", "AddSmall!") ll_Handle_SmallButton = rbb_1.InsertSmallButtonFirst (ll_Handle_Panel, "Add", "AddSmall!", "Ue_SmallButtonClicked") lr_SmallButton.Text = "Delete" lr_SmallButton.PictureName = "DeleteSmall!" lr_SmallButton.Clicked = "Ue_SmallButtonClicked" lr_SmallButton.Selected = "Ue_SmallButtonSelected" ll_Handle_SmallButton2 = rbb_1.InsertSmallButton (ll_Handle_Panel, ll_Handle_SmallButton, lr_SmallButton) //Ue_SmallButtonSelected user event must have a long parameter for receiving the handle //of SmallButton where the mouse is hovering over. Refer to the Selected property of RibbonSmallButtonItem. //event type long ue_smallbuttonselected(long itemhandle); //RibbonSmallButtonItem lr_SmallButton //rbb_1.GetSmallButton(ItemHandle,lr_SmallButton) ////... // //Return 1 //end event |
See also