Retrieves the cell's handle that is checked on a specific radio group.
Type | Description | |||
RadioGroup as Long | A long expression that indicates the radio group identifier. | |||
HCELL | A long expression that identifies the handle of the cell that's checked in the specified radio group. To retrieve the handle of the owner item you have to use CellItem property. |
A radio group contains a set of cells of radio types. Use the CellHasRadioButton property to set the cell of radio type. To change the state for a cell you can use the CellState property. To add or remove a cell to a given radio group you have to use CellHasRadioButton property. Use the CellRadioGroup property to add cells in the same radio group. The control fires the CellStateChanged event when the check box or radio button state is changed.
The following VB sample groups all cells on the first column into a radio group, and display the cell's checked on the radio group when the state of a radio group is changed:
Private Sub Tree1_AddItem(ByVal Item As EXTREELibCtl.HITEM) Tree1.Items.CellHasRadioButton(Item, 0) = True Tree1.Items.CellRadioGroup(Item, 0) = 1234 ' The 1234 is arbirary and it represents the identifier for the radio group End Sub Private Sub Tree1_CellStateChanged(ByVal Item As EXTREELibCtl.HITEM, ByVal ColIndex As Long) Debug.Print "In the 1234 radio group the """ & Tree1.Items.CellCaption(, Tree1.Items.CellChecked(1234)) & """ is checked." End Sub
The following C++ sample groups the radio cells on the first column, and displays the caption of the checked radio cell:
#include "Items.h" COleVariant vtColumn( long(0) ); CItems items = m_tree.GetItems(); m_tree.BeginUpdate(); for ( long i = 0; i < items.GetItemCount(); i++ ) { COleVariant vtItem( items.GetItemByIndex( i ) ); items.SetCellHasRadioButton( vtItem, vtColumn, TRUE ); items.SetCellRadioGroup( vtItem, vtColumn, 1234 ); } m_tree.EndUpdate();
static CString V2S( VARIANT* pv, LPCTSTR szDefault = _T("") ) { if ( pv ) { if ( pv->vt == VT_ERROR ) return szDefault; COleVariant vt; vt.ChangeType( VT_BSTR, pv ); return V_BSTR( &vt ); } return szDefault; } void OnCellStateChangedTree1(long Item, long ColIndex) { CItems items = m_tree.GetItems(); long hCell = items.GetCellChecked( 1234 ); COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR; OutputDebugString( V2S( &items.GetCellCaption( vtMissing, COleVariant( hCell ) ) ) ); }
The following VB.NET sample groups the radio cells on the first column, and displays the caption of the checked radio cell:
With AxTree1 .BeginUpdate() With .Items Dim k As Integer For k = 0 To .ItemCount - 1 .CellHasRadioButton(.ItemByIndex(k), 0) = True .CellRadioGroup(.ItemByIndex(k), 0) = 1234 Next End With .EndUpdate() End With
Private Sub AxTree1_CellStateChanged(ByVal sender As Object, ByVal e As AxEXTREELib._ITreeEvents_CellStateChangedEvent) Handles AxTree1.CellStateChanged With AxTree1.Items Debug.WriteLine(.CellCaption(, .CellChecked(1234))) End With End Sub
The following C# sample groups the radio cells on the first column, and displays the caption of the checked radio cell:
axTree1.BeginUpdate(); EXTREELib.Items items = axTree1.Items; for (int i = 0; i < items.ItemCount; i++) { items.set_CellHasRadioButton(items[i], 0, true); items.set_CellRadioGroup(items[i], 0, 1234); } axTree1.EndUpdate();
private void axTree1_CellStateChanged(object sender, AxEXTREELib._ITreeEvents_CellStateChangedEvent e) { string strOutput = axTree1.Items.get_CellCaption( 0, axTree1.Items.get_CellChecked(1234) ).ToString(); strOutput += " state = " + axTree1.Items.get_CellState(e.item, e.colIndex).ToString() ; System.Diagnostics.Debug.WriteLine( strOutput ); }
The following VFP sample groups the radio cells on the first column, and displays the caption of the checked radio cell:
thisform.Tree1.BeginUpdate() with thisform.Tree1.Items local i for i = 0 to .ItemCount - 1 .DefaultItem = .ItemByIndex(i) .CellHasRadioButton( 0,0 ) = .t. .CellRadioGroup(0,0) = 1234 next endwith thisform.Tree1.EndUpdate()
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 ( see ItemCell property ). 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