Retrieves or sets a value indicating whether the cell has associated a push button or
not.
Type | Description | |||
Item as Variant | A long expression that indicates the item's handle. | |||
ColIndex as Variant | A long expression that indicates the column's index, a string expression that indicates the column's caption or the column's key. | |||
Boolean | A boolean expression that indicates whether the cell contains a button. |
The CellHasButton property specifies whether the cell display a button inside. When the cell's button is clicked the control fires CellButtonClick event. The caption of the push button is specified by the CellCaption property. Use the Def property to assign buttons for all cells in the column. See also: CellButtonAutoWidth property. Use the Add method to add new skins to the control. Use the Background property to specify a background color or a visual appearance for specific parts in the control.
The following VB sample changes the appearance for buttons in the cells. The sample use the skin "" when the button is up, and the skin "" when the button is down:
With Tree1 With .VisualAppearance .Add &H20, App.Path + "\buttonu.ebn" .Add &H21, App.Path + "\buttond.ebn" End With .Background(exCellButtonUp) = &H20000000 .Background(exCellButtonDown) = &H21000000 End With
The following C++ sample changes the appearance for buttons in the cells:
#include "Appearance.h" m_tree.GetVisualAppearance().Add( 0x20, COleVariant(_T("D:\\Temp\\ExTree.Help\\buttonu.ebn")) ); m_tree.GetVisualAppearance().Add( 0x21, COleVariant(_T("D:\\Temp\\ExTree.Help\\buttond.ebn")) ); m_tree.SetBackground( 2 /*exCellButtonUp*/, 0x20000000 ); m_tree.SetBackground( 3 /*exCellButtonDown*/, 0x21000000 );
The following VB.NET sample changes the appearance for buttons in the cells.
With AxTree1 With .VisualAppearance .Add(&H20, "D:\Temp\ExTree.Help\buttonu.ebn") .Add(&H21, "D:\Temp\ExTree.Help\buttond.ebn") End With .set_Background(EXTREELib.BackgroundPartEnum.exCellButtonUp, &H20000000) .set_Background(EXTREELib.BackgroundPartEnum.exCellButtonDown, &H21000000) End With
The following C# sample changes the appearance for buttons in the cells.
axTree1.VisualAppearance.Add(0x20, "D:\\Temp\\ExTree.Help\\buttonu.ebn"); axTree1.VisualAppearance.Add(0x21, "D:\\Temp\\ExTree.Help\\buttond.ebn"); axTree1.set_Background(EXTREELib.BackgroundPartEnum.exCellButtonUp, 0x20000000); axTree1.set_Background(EXTREELib.BackgroundPartEnum.exCellButtonDown, 0x21000000);
The following VFP sample changes the appearance for buttons in the cells.
With thisform.Tree1 With .VisualAppearance .Add(32, "D:\Temp\ExTree.Help\buttonu.ebn") .Add(33, "D:\Temp\ExTree.Help\buttond.ebn") EndWith .Object.Background(2) = 536870912 .Object.Background(3) = 553648128 endwith
the 536870912 indicates the 0x20000000 value in hexadecimal, and the 553648128 indicates the 0x21000000 value in hexadecimal.
The following VB sample sets the cells of the first column to be of button type, and displays a message if the button is clicked:
Private Sub Tree1_AddItem(ByVal Item As EXTREELibCtl.HITEM) Tree1.Items.CellHasButton(Item, 0) = True End Sub Private Sub Tree1_CellButtonClick(ByVal Item As EXTREELibCtl.HITEM, ByVal ColIndex As Long) MsgBox "The cell of button type has been clicked" End Sub
The following VB sample assigns a button to the focused cell:
With Tree1.Items .CellHasButton(.FocusItem, 0) = True End With
The following C++ sample assigns a button to the focused cell:
#include "Items.h" CItems items = m_tree.GetItems(); items.SetCellHasButton( COleVariant( items.GetFocusItem() ), COleVariant( (long)0 ), TRUE );
The following VB.NET sample assigns a button to the focused cell:
With AxTree1.Items .CellHasButton(.FocusItem, 0) = True End With
The following C# sample assigns a button to the focused cell:
axTree1.Items.set_CellHasButton(axTree1.Items.FocusItem, 0, true);
The following VFP sample assigns a button to the focused cell:
with thisform.Tree1.Items .DefaultItem = .FocusItem .CellHasButton(0,0) = .t. endwith
Note: A cell is the intersection of an item with a column. All properties that has an Item and a ColIndex parameters are referring to a cell. The Item parameter represents the handle of an item, and the ColIndex parameter indicates an index ( a numerical value, see Column.Index property ) of a column , the column's caption ( a string value, see Column.Caption property ), or a handle to a cell. Here's few hints how to use properties with Item and ColIndex parameters:
Tree1.Items.CellBold(, Tree1.Items.ItemCell(Tree1.Items(0), 0)) = True
Tree1.Items.CellBold(Tree1.Items(0), 0) = True
Tree1.Items.CellBold(Tree1.Items(0), "ColumnName") = True