method Editor.AddButton (Key as Variant, [Image as Variant], [Align as Variant], [ToolTip as Variant], [ToolTipTitle as Variant], [ShortcutKey as Variant])
Adds a new button to the editor with specified key and aligns it to the left or right side of the editor.

 TypeDescription 
   Key as Variant A Variant value that indicates the button's key. The ButtonClick event passes this value to Key parameter  
   Image as Variant A long expression that indicates the index of button's icon. The index is valid for Images collection. By default the button has no icon associated. Use the Images property to assign a list of icons to the control.   
   Align as Variant An AlignmentEnum expression that defines the button's alignment.  
   ToolTip as Variant A string expression that indicates the the button's tooltip description. The tooltip shows up when cursor hovers the button. The ToolTip parameter may include built-in HTML tags.  
   ToolTipTitle as Variant A string expression that indicates the tooltip's title.  
   ShortcutKey as Variant A short expression that indicates the shortcut key being used to simulate clicking the button. The lower byte indicates the code of the virtual key, and the higher byte indicates the states for SHIFT, CTRL and ALT keys ( last insignificant bits in the higher byte ). The ShortcutKey expression could be 256 *( ( shift ? 1 : 0 ) + (ctrl ? 2 : 0 ) + (alt ? 4 : 0) ) + vbKeyCode, For instance, a combination like CTRL + F3 is 256 * 2 + vbKeyF3, SHIFT + CTRL + F2 is 256 *(1 + 2) + vbKeyF2, and SHIFT + CTRL + ALT + F5 is 256 * (1 + 2 + 4) + vbKeyF5.  
Use the AddButton method to add multiple buttons to the editor.  Make sure that you are using unique keys for the buttons in the same editor, else the previous button is replaced. The editor doesn't allow two buttons with the same key. Use the ButtonWidth property to set the button's width. If the user clicks on one of the editor buttons, the ButtonClick event is fired. Use the RemoveButton method to remove a button that was previously added using the AddButton method. Use the ClearButtons method to clear the entire collection of buttons added with AddButton method. Use the Images property to assign a list of icons to the control.

The following VB sample adds some buttons to a CalculatorType editor:

The following VC sample adds some buttons to a CalculatorType editor:

 

 


Send comments on this topic.
1999-2015 Exontrol.COM, Software. All rights reserved.