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.

   Key as Variant A Variant expression that indicates the key of the button being added.  
   Image as Variant A long expression that indicates the index of icon being displayed in the button.  
   Align as Variant An AlignmentEnum expression that indicates the button's alignment inside the node.  
   ToolTip as Variant A  string expression that indicates the button's tooltip. The button's tooltip shows up when user hovers the cursor over the button. The ToolTip value accepts built-in HTML format like described in the Remarks paragraf.   
   ToolTipTitle as Variant A string expression that indicates the title of the button's tooltip.  
   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 new buttons to an editor. Use the ButtonClick event to notify your application that the user clicks a button inside a node. Use the Editors property to access the control's Editors collection. Use the Add method to add new type of editors to the control. Use the Editor property to assign an editor to a node. Use the ButtonWidth property to specify the width of the buttons inside the editor.

The following sample displays a message box when user clicks the 'A' button:

Private Sub Form_Load()
    With XMLGrid1
            With .Editors
                With .Add("Spin")
                    .ButtonWidth = 18
                    .EditType = SpinType
                    .AddButton "A", 1
                End With
            End With
            With .Nodes
                With .Add("Spin", 1)
                    .Editor = "Spin"
                End With
            End With
    End With
End Sub

Private Sub XMLGrid1_ButtonClick(ByVal Node As EXMLGRIDLibCtl.INode, ByVal Key As Variant)
    If Key = "A" Then
        MsgBox "You have clicked the 'A' button."
    End If
End Sub
The control uses built-in HTML tags to display the caption using HTML format. The control supports the following HTML tags:   

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