Click here to Skip to main content
15,881,852 members
Articles / Desktop Programming / MFC

CTreeOptionsCtrl v1.21

Rate me:
Please Sign up or sign in to vote.
4.85/5 (20 votes)
3 Mar 2000 271.1K   2.9K   72  
A freeware MFC class to provide a tree options control.
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<title>CTreeOptionsCtrl v1.21</title>
</head>

<body bgcolor="#FFFFFF">

<p align="left"><font size="5" face="Arial"><strong>CTreeOptionsCtrl v1.21</strong></font></p>

<p><font face="Arial">Welcome to <strong>CTreeOptionsCtrl</strong>, a control which
implements a tree options control similar to the advanced tab as seen on the
&quot;Internet Options&quot; dialog in Internet Explorer 4 and later. In
addition to check boxes and radio buttons, it also allows edit boxes and combo
boxes to be included in the tree control, similar to the new printer property
dialogs which are in Windows 2000. Included below is a
snapshot showing the demo application and what the control looks like.&nbsp;</font></p>

<p>&nbsp;</p>

<p><img border="0" src="treeoptionsctrl.gif" width="545" height="314"></p>

<p>&nbsp;</p>

<table border="0">
  <tr>
    <td><a href="#Features"><font face="Arial">Features</font></a></td>
  </tr>
  <tr>
    <td><a href="#Usage"><font face="Arial">Usage</font></a></td>
  </tr>
  <tr>
    <td><a href="#History"><font face="Arial">History</font></a></td>
  </tr>
  <tr>
    <td><a href="#APIReference"><font face="Arial">API Reference</font></a></td>
  </tr>
  <tr>
    <td><a href="#Enhancements"><font face="Arial">Planned Enhancements</font></a></td>
  </tr>
  <tr>
    <td><a href="#Contact"><font face="Arial">Contacting the Author</font></a></td>
  </tr>
</table>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p><a name="Features"></a><font size="4" face="Arial"><strong>Features</strong></font> 

<ul>
  <li><font color="#000000" size="3" face="Arial">Derived from the MFC class CTreeCtrl so if
    you have used this class before, then you should get up to speed using the
    CTreeOptionsCtrl pretty easily.</font></li>
  <li><font color="#000000" size="3" face="Arial">Code is UNICODE enabled and build
    configurations are provided.</font></li>
  <li><font color="#000000" size="3" face="Arial">Combo boxes and edit boxes
    that are created can be customized without affected the base code.</font></li>
  <li><font color="#000000" size="3" face="Arial">All code compiles cleanly at level 4.</font></li>
  <li><font color="#000000" size="3" face="Arial">Small footprint, total size amounts to just
    c. 900 lines of code.</font></li>
</ul>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p><a name="Usage"></a><font size="4" face="Arial"><strong>Usage</strong></font> 

<ul>
  <li><font color="#000000" size="3" face="Arial">To use the class in your code simply include
    TreeOptionsCtrl.cpp in your project and #include &quot;TreeOptionsCtrl.h&quot; in which
    ever of your modules needs to make calls to the class.</font></li>
  <li><font color="#000000" size="3" face="Arial">You will need to copy over the
    IDB_TREE_CTRL_OPTIONS bitmap which is used for the image list for the tree control.
    Hooking up the image list to the tree control is done automatically so you
    do not need to handle this. You are free to use to add your own bitmaps to the end of this to
    represent customized groups but you should leave the first 8 items intact in the image
    list. The code in CTreeOptionsCtrl assumes that the unchecked check item is at offset 0,
    the checked check item is at offset 1, the unchecked radio item is at offset 2 and the
    checked radio item is at offset 3. The bitmaps from offset 4 to 7 represent the disabled
    versions of the first 4 bitmaps</font></li>
  <li><font face="Arial">Your code will need to include MFC either statically or dynamically.</font></li>
  <li><font face="Arial">To see the class in action, have a look at the usage of the code in
    the module &quot;appDlg.cpp&quot;.</font></li>
</ul>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p><a name="History"></a><font color="#000000" size="5" face="Arial"><strong>History</strong></font></p>

<p><font color="#000000" size="3" face="Arial"><strong>V1.0 (2 April 1999)</strong></font>

<ul>
  <li><font color="#000000" size="3" face="Arial">Initial public release.</font></li>
</ul>

<p><font color="#000000" size="3" face="Arial"><strong>V1.01 (20 April 1999)</strong></font>

<ul>
  <li><font color="#000000" size="3" face="Arial">Minor Update to the bitmap which is used as
    the image list for the tree control.</font></li>
</ul>

<p><font color="#000000" size="3" face="Arial"><strong>V1.1 (21 April 1999)</strong></font>

<ul>
  <li><font color="#000000" size="3" face="Arial">Added full support for enabling / disabling
    of group, check box and radio button items.</font></li>
</ul>

<p><font color="#000000" size="3" face="Arial"><strong>V1.11 (5 October 1999)</strong></font>

<ul>
  <li><font color="#000000" size="3" face="Arial">Made class more self contained by internally managing the image list</font><font color="#000000" size="3" face="Arial">.</font></li>
</ul>

<p><font color="#000000" size="3" face="Arial"><strong>V1.2 (8 October 1999)</strong></font>

<ul>
  <li><font color="#000000" size="3" face="Arial"> Added support for including combo boxes aswell as edit boxes into the
    edit control.</font></li>
  <li><font color="#000000" size="3" face="Arial">Added support for customizing the image list to use</font></li>
</ul>

<p><font color="#000000" size="3" face="Arial"><strong>V1.21 (29 February 2000)</strong></font>

<ul>
  <li><font face="Arial"> Removed a VC 6 level 4 warning</font></li>
</ul>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p class="crt"><a name="APIReference"></a><font size="4" face="Arial"><strong>API
Reference</strong></font></p>

<p><font face="Arial">The API consists of the following class members and global functions</font></p>

<p align="left"><font face="Arial"><strong><a href="#SetImageListToUse">CTreeOptionsCtrl::SetImageListToUse</a><br>
<a href="#InsertGroup">CTreeOptionsCtrl::InsertGroup</a><br>
<a href="#InsertCheckBox">CTreeOptionsCtrl::InsertCheckBox</a><br>
<a href="#InsertRadioButton">CTreeOptionsCtrl::InsertRadioButton</a><br>
<a href="#ISGroup">CTreeOptionsCtrl::IsGroup</a><br>
<a href="#IsCheckBox">CTreeOptionsCtrl::IsCheckBox</a><br>
<a href="#InsertRadioButton">CTreeOptionsCtrl::IsRadioButton</a><br>
<a href="#SetCheckBox">CTreeOptionsCtrl::SetCheckBox</a><br>
<a href="#GetCheckBox">CTreeOptionsCtrl::GetCheckBox</a><br>
<a href="#GetRadioButton">CTreeOptionsCtrl::GetRadioButton</a><br>
<a href="#SetRadioButton">CTreeOptionsCtrl::SetRadioButton</a><br>
<a href="#SetGroupEnable">CTreeOptionsCtrl::SetGroupEnable</a><br>
<a href="#SetCheckBoxEnable">CTreeOptionsCtrl::SetCheckBoxEnable</a><br>
<a href="#SetRadioButtonEnable">CTreeOptionsCtrl::SetRadioButtonEnable</a><br>
<a href="#GetRadioButtonEnable">CTreeOptionsCtrl::GetRadioButtonEnable</a><br>
<a href="#GetCheckBoxEnable">CTreeOptionsCtrl::GetCheckBoxEnable</a><br>
<a href="#AddComboBox">CTreeOptionsCtrl::AddComboBox<br>
</a><a href="#AddEditBox">CTreeOptionsCtrl::AddEditBox</a><br>
<a href="#GetComboText">CTreeOptionsCtrl::GetComboText</a><br>
<a href="#GetEditText">CTreeOptionsCtrl::GetEditText</a><br>
<a href="#SetEditText">CTreeOptionsCtrl::SetComboText</a><br>
<a href="#SetEditText">CTreeOptionsCtrl::SetEditText</a><br>
<a href="#DDX_TreeCheck">DDX_TreeCheck</a><br>
<a href="#DDX_TreeRadio">DDX_TreeRadio<br>
</a><a href="#DDX_TreeEdit">DDX_TreeEdit</a><br>
<a href="#DDX_TreeCombo">DDX_TreeCombo</a></strong></font></p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p><a name="SetImageListToUse"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::SetImageListToUse</strong></font></p>

<p><font face="Arial"><strong>void SetImageListToUse(UINT </strong><em>nResourceID</em><strong>);</strong></font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>nResourceID</em> The resource ID of the bitmap to use</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Allows you to customize what bitmap to use as the image
list for the tree options control.</font></p>

<p>&nbsp;</p>

<p><a name="InsertGroup"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::InsertGroup</strong></font></p>

<p><font face="Arial"><strong>BOOL InsertGroup(LPCTSTR </strong><em>lpszItem</em><strong>,
int </strong><em>nImage</em><strong>, HTREEITEM </strong><em>hParent =</em><strong>
TVI_ROOT);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the group item was successfully added otherwise
FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>lpszItem</em> The text of the item to add.</font></p>

<p><font face="Arial"><em>nImage</em> The zero based index of the icon in the tree
controls image list to use for this group item.</font></p>

<p><font face="Arial"><em>hParent</em> Handle of the parent where the item should be
inserted.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Adds a group item to the tree control. A group item is the parent of
either a collection of radio items or check items. In the sample app, the two items which
are group items are &quot;Accessibility (Example of check options)&quot; and &quot;When
Searching (Example of radio options)&quot;. The first 8 icons of the image list associated
with the tree options control are reserved and you should specify a <em>&quot;nImage&quot;</em>
value greater than 7 when adding a group item. By default the function will add items at
the root level of the tree control but you can add them at any depth using the <em>&quot;hParent&quot;</em>
parameter. You can see this in the &quot;Internet options&quot; dialog which the control
emulates.</font></p>

<p>&nbsp;</p>

<p><a name="InsertCheckBox"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::InsertCheckBox</strong></font></p>

<p><font face="Arial"><strong>BOOL InsertCheckBox(LPCTSTR </strong><em>lpszItem</em><strong>,
HTREEITEM </strong><em>hParent</em><strong>, BOOL </strong><em>bCheck = </em><strong>TRUE);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the check box item was successfully added
otherwise FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>lpszItem</em> The text of the item to add.</font></p>

<p><font face="Arial"><em>hParent</em> Handle of the parent where the item should be
inserted.</font></p>

<p><font face="Arial"><em>bCheck</em> The initial checked state of the check box. TRUE if
the item is to be checked, FALSE to leave it unchecked.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Adds a check box item to the tree control. A check box item behaves
the same as a normal check box. Using the space bar or left mouse button will toggle its
state. The parent of the check box item must be a group item as added with <a
href="#InsertGroup"><strong>InsertGroup</strong></a></font></p>

<p>&nbsp;</p>

<p><a name="InsertRadioButton"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::InsertRadioButton</strong></font></p>

<p><font face="Arial"><strong>BOOL InsertRadioButton(LPCTSTR </strong><em>lpszItem</em><strong>,
HTREEITEM </strong><em>hParent</em><strong>, BOOL </strong><em>bCheck = </em><strong>TRUE);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the radio button item was successfully added
otherwise FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>lpszItem</em> The text of the item to add.</font></p>

<p><font face="Arial"><em>hParent</em> Handle of the parent where the item should be
inserted.</font></p>

<p><font face="Arial"><em>bCheck</em> The initial checked state of the check box. TRUE if
the item is to be checked, FALSE to leave it unchecked.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Adds a radio button item to the tree control. A radio button item
behaves the same as a normal radio button i.e. when a radio button is checked all the
other items in the same group are unchecked. Using the space bar or left mouse button will
toggle its state. The parent of the radio button item must be a group item as added with <a
href="#InsertGroup"><strong>InsertGroup</strong></a></font></p>

<p>&nbsp;</p>

<p><a name="ISGroup"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::IsGroup</strong></font></p>

<p><font face="Arial"><strong>BOOL IsGroup(HTREEITEM </strong><em>hItem</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the specified item is a group item otherwise
FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the item to check the type of.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Checks to see if the specified item is a group item i.e. an item
which is the parent of a collection of radio button or check box items.</font></p>

<p>&nbsp;</p>

<p><a name="IsCheckBox"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::IsCheckBox</strong></font></p>

<p><font face="Arial"><strong>BOOL IsCheckBox(HTREEITEM </strong><em>hItem</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the specified item is a check box item otherwise
FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the item to check the type of.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Checks to see if the specified item is a check box item.</font></p>

<p>&nbsp;</p>

<p><a name="IsRadioButton"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::IsRadioButton</strong></font></p>

<p><font face="Arial"><strong>BOOL IsRadioButton(HTREEITEM </strong><em>hItem</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the specified item is a radio button item
otherwise FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the item to check the type of.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Checks to see if the specified item is a radio button item.</font></p>

<p>&nbsp;</p>

<p><a name="SetCheckBox"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::SetCheckBox</strong></font></p>

<p><font face="Arial"><strong>BOOL SetCheckBox(HTREEITEM </strong><em>hItem</em><strong>,
BOOL </strong><em>bCheck</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the check state of the item was successfully
changed otherwise FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the item to change the checked state of.</font></p>

<p><font face="Arial"><em>bCheck</em> The state of the check box to be set. TRUE if the
item is to be checked, FALSE to uncheck the item.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Changes the checked state of a check box item.</font></p>

<p>&nbsp;</p>

<p><a name="GetCheckBox"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::GetCheckBox</strong></font></p>

<p><font face="Arial"><strong>BOOL GetCheckBox(HTREEITEM </strong><em>hItem</em><strong>,
BOOL&amp; </strong><em>bCheck</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the check state of the item was successfully
retrieved otherwise FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the item to retrieve the checked state of.</font></p>

<p><font face="Arial"><em>bCheck</em> Upon successful return, this will contain the state
of the check box. TRUE if the item is checked, FALSE if unchecked.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Retrieves the checked state of a check box item.</font></p>

<p>&nbsp;</p>

<p><a name="SetRadioButton"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::SetRadioButton</strong></font></p>

<p><font face="Arial"><strong>BOOL SetRadioButton(HTREEITEM </strong><em>hParent</em><strong>,
int </strong><em>nIndex</em><strong>);</strong></font></p>

<p><font face="Arial"><strong>BOOL SetRadioButton(HTREEITEM </strong><em>hItem</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the check state of the specified radio button in
the specified group was successfully set otherwise FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hParent</em> Handle of the parent group item which contains the
radio button items.</font></p>

<p><font face="Arial"><em>nIndex</em> The index of the radio button in the group to
select.</font></p>

<p><font face="Arial">hItem The item in the radio button group to check.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Changes the checked state of the specified item in the specified
radio button group. The item specified by the value <em>&quot;nIndex&quot;</em> or <em>&quot;hItem&quot;</em>
is checked and all the other items in the group are unchecked.</font></p>

<p>&nbsp;</p>

<p><a name="GetRadioButton"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::GetRadioButton</strong></font></p>

<p><font face="Arial"><strong>BOOL GetRadioButton(HTREEITEM </strong><em>hParent</em><strong>,
int&amp; </strong><em>nIndex</em><strong>, HTREEITEM&amp; </strong><em>hCheckItem</em><strong>);</strong></font></p>

<p><font face="Arial"><strong>BOOL GetRadioButton(HTREEITEM </strong><em>hItem</em><strong>,
BOOL&amp; </strong><em>bCheck</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the check state was successfully retrieved
otherwise FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hParent</em> Handle of the parent group item which contains the
radio button items.</font></p>

<p><font face="Arial"><em>nIndex</em> Upon successful return, this will contain the index
of the radio button in the group which is checked.</font></p>

<p><font face="Arial"><em>hCheckItem</em> Upon successful return, this will contain the
handle of the radio button item which is checked.</font></p>

<p><font face="Arial"><em>hItem</em> Handle of the radio button item to check the state
of.</font></p>

<p><font face="Arial"><em>bCheck</em> Upon successful return, this will contain the state
of the radio button. TRUE if the item is checked, FALSE if unchecked.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Retrieves the checked state of a radio button item.</font></p>

<p>&nbsp;</p>

<p><a name="SetGroupEnable"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::SetGroupEnable</strong></font></p>

<p><font face="Arial"><strong>BOOL SetGroupEnable(HTREEITEM </strong><em>hItem</em><strong>,
BOOL </strong><em>bEnable</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the check state of the items in the group were
successfully enabled / disabled.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the group item to enable or disable.</font></p>

<p><font face="Arial"><em>bEnable</em> TRUE if the items should be enabled, FALSE to
disable the items.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Enables or disables all the items under a group item.</font></p>

<p>&nbsp;</p>

<p><font size="4" face="Arial"><a name="SetCheckBoxEnable"></a><strong>CTreeOptionsCtrl::SetCheckBoxEnable</strong></font></p>

<p><font face="Arial"><strong>BOOL SetCheckBoxEnable(HTREEITEM </strong><em>hItem</em><strong>,
BOOL </strong><em>bEnable</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the check state of the check box item was
successfully enabled / disabled.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the check box item to enable or disable.</font></p>

<p><font face="Arial"><em>bEnable</em> TRUE if the item should be enabled, FALSE to
disable the item.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Enables or disables the specified check box item.</font></p>

<p>&nbsp;</p>

<p><a name="SetRadioButtonEnable"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::SetRadioButtonEnable</strong></font></p>

<p><font face="Arial"><strong>BOOL SetRadioButtonEnable(HTREEITEM </strong><em>hItem</em><strong>,
BOOL </strong><em>bEnable</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the check state of the radio button item was
successfully enabled / disabled.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the radio button item to enable or disable.</font></p>

<p><font face="Arial"><em>bEnable</em> TRUE if the item should be enabled, FALSE to
disable the item.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Enables or disables the specified radio button item.</font></p>

<p>&nbsp;</p>

<p><a name="GetRadioButtonEnable"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::GetRadioButtonEnable</strong></font></p>

<p><font face="Arial"><strong>BOOL GetRadioButtonEnable(HTREEITEM </strong><em>hItem</em><strong>,
BOOL&amp; </strong><em>bEnable</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the enabled state of the item was successfully
retrieved otherwise FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the item to retrieve the enabled state of.</font></p>

<p><font face="Arial"><em>bCheck</em> Upon successful return, this will contain the
enabled state of the radio button. TRUE if the item is enabled, FALSE if disabled.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Retrieves the enabled state of a radio button item.</font></p>

<p>&nbsp;</p>

<p><font size="4" face="Arial"><a name="GetCheckBoxEnable"></a><strong>CTreeOptionsCtrl::GetCheckBoxButtonEnable</strong></font></p>

<p><font face="Arial"><strong>BOOL GetCheckBoxEnable(HTREEITEM </strong><em>hItem</em><strong>,
BOOL&amp; </strong><em>bEnable</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the enabled state of the item was successfully
retrieved otherwise FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the item to retrieve the enabled state of.</font></p>

<p><font face="Arial"><em>bCheck</em> Upon successful return, this will contain the
enabled state of the check box. TRUE if the item is enabled, FALSE if disabled.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Retrieves the enabled state of a check box item.</font></p>

<p>&nbsp;</p>

<p><a name="AddComboBox"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::AddComboBox</strong></font></p>

<p><font face="Arial"><strong>BOOL AddComboBox(HTREEITEM </strong><em>hItem</em><strong>,
CRuntimeClass* </strong><em>pRuntimeClass</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the combo box item was successfully
added otherwise FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the item to add the combo box at.</font></p>

<p><font face="Arial"><em>pRuntimeClass</em> The runtime class pointer on a
class derived from &quot;CTreeOptionsCombo&quot; which is to be added to the
tree options control.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Adds a combo box item to the tree control. The combo box
by default provides a choice of multiple strings from which to pick. You are
free to derive your own class from &quot;CTreeOptionsCombo&quot; to implement
customized </font><font face="Arial">behavior</font></p>

<p>&nbsp;</p>

<p><a name="AddEditBox"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::AddEditBox</strong></font></p>

<p><font face="Arial"><strong>BOOL AddEditBox(HTREEITEM </strong><em>hItem</em><strong>,
CRuntimeClass* </strong><em>pRuntimeClass</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the edit box item was successfully added
otherwise FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the item to add the edit box at.</font></p>

<p><font face="Arial"><em>pRuntimeClass</em> The runtime class pointer on a
class derived from &quot;CTreeOptionsEdit&quot; which is to be added to the tree
options control.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Adds a edit box item to the tree control. The edit box by
default allows any text to be set. You are free to derive your own class from
&quot;CTreeOptionsCombo&quot; to implement customized behavior</font></p>

<p>&nbsp;</p>

<p><a name="GetComboText"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::GetComboText</strong></font></p>

<p><font face="Arial"><strong>CString GetComboText(HTREEITEM </strong><em>hItem</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">The text associated with this combo box item.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the item to retrieve the combo
box text of.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Retrieves the combo text of a combo box item.</font></p>

<p>&nbsp;</p>

<p><a name="GetEditText"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::GetEditText</strong></font></p>

<p><font face="Arial"><strong>CString GetEditText(HTREEITEM </strong><em>hItem</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">The text associated with this edit box item.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the item to retrieve the edit box
text of.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Retrieves the edit box text of a edit box item.</font></p>

<p>&nbsp;</p>

<p><a name="SetComboText"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::SetComboText</strong></font></p>

<p><font face="Arial"><strong>BOOL SetComboText(HTREEITEM </strong><em>hItem</em><strong>,
const CString&amp; </strong><em>sComboText</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the text of the item was successfully
changed otherwise FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the item to change the combo box
text of.</font></p>

<p><font face="Arial"><em>sComboText</em> The text to set in the combo box.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Changes the combo box text of a combo box item.</font></p>

<p>&nbsp;</p>

<p><a name="SetEditText"></a><font size="4" face="Arial"><strong>CTreeOptionsCtrl::SetEditText</strong></font></p>

<p><font face="Arial"><strong>BOOL SetEditText(HTREEITEM </strong><em>hItem</em><strong>,
const CString&amp; </strong><em>sEditText</em><strong>);</strong></font></p>

<p class="rl"><font face="Arial"><strong>Return Value</strong></font></p>

<p class="t"><font face="Arial">TRUE if the text of the item was successfully
changed otherwise FALSE.</font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p><font face="Arial"><em>hItem</em> Handle of the item to change the edit box
text of.</font></p>

<p><font face="Arial"><em>sEditText</em> The text to set in the edit box.</font></p>

<p><font face="Arial"><strong>Remarks</strong></font></p>

<p><font face="Arial">Changes the edit box text of a edit box item.</font></p>

<p>&nbsp;</p>

<p><a name="DDX_TreeCheck"></a><font face="Arial"><strong>void
DDX_TreeCheck(CDataExchange* </strong><em>pDX</em><strong>, int </strong><em>nIDC</em><strong>,
HTREEITEM </strong><em>hItem</em><strong>, BOOL&amp; </strong><em>bCheck</em><strong>);</strong></font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p class="dt1"><font face="Arial"><em><span class="p">pDX</span></em> A pointer to a <span
class="op">CDataExchange</span> object. The framework supplies this object to establish
the context of the data exchange, including its direction.</font></p>

<p class="dt1"><font face="Arial"><em><span class="p">nIDC</span></em> The resource ID of
the tree control associated with the control property.</font></p>

<p><font face="Arial"><em>hItem</em> Handle of the check box item to get/set the state of.</font></p>

<p class="dt1"><font face="Arial"><em><span class="p">bCheck</span></em>&nbsp;A reference
to a member variable of the dialog box, form view, or control view object with which data
is exchanged.</font></p>

<p class="rl"><font face="Arial"><strong>Remarks</strong></font></p>

<p class="t"><font face="Arial">The <span class="op">DDX_TreeCheck</span> function manages
the transfer of <span class="op">BOOL</span> data between a check box item in the
CTreeOptionsCtrl in a dialog box, form view, or control view object and a <span class="op">BOOL</span>
data member of the dialog box, form view, or control view object.</font></p>

<p>&nbsp;</p>

<p><a name="DDX_TreeRadio"></a><font face="Arial"><strong>void
DDX_TreeRadio(CDataExchange* </strong><em>pDX</em><strong>, int </strong><em>nIDC</em><strong>,
HTREEITEM </strong><em>hParent</em><strong>, int&amp; </strong><em>nIndex</em><strong>);</strong></font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p class="dt1"><font face="Arial"><em><span class="p">pDX</span></em> A pointer to a <span
class="op">CDataExchange</span> object. The framework supplies this object to establish
the context of the data exchange, including its direction.</font></p>

<p class="dt1"><font face="Arial"><em><span class="p">nIDC</span></em> The resource ID of
the tree control associated with the control property.</font></p>

<p><font face="Arial"><em>hParent</em> Handle of the parent group item which contains the
radio button items.</font></p>

<p class="dt1"><font face="Arial"><em><span class="p">nIndex</span></em>&nbsp;A reference
to a member variable of the dialog box, form view, or control view object with which data
is exchanged.</font></p>

<p class="rl"><font face="Arial"><strong>Remarks</strong></font></p>

<p class="t"><font face="Arial">The <span class="op">DDX_TreeRadio</span> function manages
the transfer of <span class="op">int</span> data between a radio button group in the
CTreeOptionsCtrl in a dialog box, form view, or control view object and an int data member
of the dialog box, form view, or control view object.</font></p>

<p>&nbsp;</p>

<p><a name="DDX_TreeEdit"></a><font face="Arial"><strong>void
DDX_TreeEdit(CDataExchange* </strong><em>pDX</em><strong>, int </strong><em>nIDC</em><strong>,
HTREEITEM </strong><em>hItem</em><strong>, CString&amp; </strong><i>sText</i><strong>);</strong></font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p class="dt1"><font face="Arial"><em><span class="p">pDX</span></em> A pointer to a <span
class="op">CDataExchange</span> object. The framework supplies this object to establish
the context of the data exchange, including its direction.</font></p>

<p class="dt1"><font face="Arial"><em><span class="p">nIDC</span></em> The resource ID of
the tree control associated with the control property.</font></p>

<p><font face="Arial"><em>hParent</em> Handle of the parent group item which contains the
radio button items.</font></p>

<p class="dt1"><font face="Arial"><em><span class="p">sText</span></em>&nbsp;A reference
to a CString which is the text to display or retrieve from the tree options
control.</font></p>

<p class="rl"><font face="Arial"><strong>Remarks</strong></font></p>

<p class="t"><font face="Arial">The <span class="op">DDX_TreeEdit</span> function manages
the transfer of CString data between a edit box in the
CTreeOptionsCtrl in a dialog box, form view, or control view object and an
CString data member.</font></p>

<p>&nbsp;</p>

<p><a name="DDX_TreeCombo"></a><font face="Arial"><strong>void
DDX_TreeCombo(CDataExchange* </strong><em>pDX</em><strong>, int </strong><em>nIDC</em><strong>,
HTREEITEM </strong><em>hItem</em><strong>, CString&amp; </strong><i>sText</i><strong>);</strong></font></p>

<p><font face="Arial"><strong>Parameters</strong></font></p>

<p class="dt1"><font face="Arial"><em><span class="p">pDX</span></em> A pointer to a <span
class="op">CDataExchange</span> object. The framework supplies this object to establish
the context of the data exchange, including its direction.</font></p>

<p class="dt1"><font face="Arial"><em><span class="p">nIDC</span></em> The resource ID of
the tree control associated with the control property.</font></p>

<p><font face="Arial"><em>hParent</em> Handle of the parent group item which contains the
radio button items.</font></p>

<p class="dt1"><font face="Arial"><em><span class="p">sText</span></em>&nbsp;A reference
to a CString which is the text to display or retrieve from the tree options
control.</font></p>

<p class="rl"><font face="Arial"><strong>Remarks</strong></font></p>

<p class="t"><font face="Arial">The <span class="op">DDX_TreeCombo</span> function manages
the transfer of CString data between a combo box in the
CTreeOptionsCtrl in a dialog box, form view, or control view object and an
CString data member.</font></p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p><a name="Enhancements"></a><font color="#000000" size="4" face="Arial"><strong>PLANNED
ENHANCEMENTS</strong></font><font face="Arial"> </font>

<ul>
  <li><font color="#000000" size="3" face="Arial">If you have any other suggested
    improvements, please let me know so that I can incorporate them into the next release.</font></li>
</ul>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p><a name="Contact"></a><font color="#000000" size="4" face="Arial"><strong>CONTACTING
THE AUTHOR</strong></font></p>

<p><font color="#000000" size="3" face="Arial">PJ Naughter<br>
Email: <a href="mailto:pjn@indigo..ie">pjn@indigo.ie</a><br>
Web: <a href="http://indigo.ie/~pjn">http://indigo.ie/~pjn</a><br>
29 February 2000</font></p>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions