2025-11-27 16:46:48 +09:00

94 lines
9.7 KiB
Plaintext

{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f37\froman\fcharset238\fprq2 Times New Roman CE;}
{\f38\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f40\froman\fcharset161\fprq2 Times New Roman Greek;}{\f41\froman\fcharset162\fprq2 Times New Roman Tur;}{\f42\froman\fcharset177\fprq2 Times New Roman (Hebrew);}
{\f43\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f44\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f45\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*\cs10 \additive \ssemihidden
Default Paragraph Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rsidtbl \rsid2582882\rsid5862705
\rsid9898003}{\*\generator Microsoft Word 11.0.5604;}{\info{\author TvmServer}{\operator TvmServer}{\creatim\yr2005\mo1\dy17\hr16\min50}{\revtim\yr2005\mo1\dy17\hr16\min50}{\version4}{\edmins0}{\nofpages3}{\nofwords652}{\nofchars3720}
{\*\company Dundas India}{\nofcharsws4364}{\vern24689}}\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3
\jcompress\viewkind1\viewscale116\viewzk2\nolnhtadjtbl\rsidroot5862705 \fet0\sectd \linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3
\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}
{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain
\ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\b\fs48\cf2\insrsid9898003 COXOptionTreeCtrl}{\b\fs48\insrsid9898003
\par }{\b\fs16\insrsid9898003 Copyright \'a9}{\b\fs16\insrsid5862705 The Code Project}{\b\fs16\insrsid2582882 1997-2005}{\b\fs16\insrsid9898003 , All Rights Reserved
\par }{\insrsid9898003
\par COXOptionTreeControl is }{\insrsid9898003 a }{\insrsid9898003
CTreeCtrl derived class that allows you to use check boxes and radio buttons as tree items. Tree control functionality allows you to organize them in groups, which provides a compact way of displaying and navigating through a big number of option
s that can be represented using check box or radio button.
\par
\par In most cases options should be organized in some logical way. We associate a tree control brunch with any of such group of options and call them "control groups". Please note that the functionali
ty of the tree control allows you to use multiple level of dependency between groups and subgroups. In order to add new control group in the tree control you have to call the following function:
\par }\pard \ql \li360\ri360\nowidctlpar\faauto\rin360\lin360\itap0 {\ul\cf2\insrsid9898003 AddControlGroup();}{\insrsid9898003
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid9898003
\par Using this function you may create any control groups. This function returns a handle to the tree item that was created to display the control group title. You can use this value to add check boxes, radio buttons or other control groups.
\par In order to add new check box item in the tree you have to use the following function:
\par }\pard \ql \li360\ri360\nowidctlpar\faauto\rin360\lin360\itap0 {\ul\cf2\insrsid9898003 AddCheckBox();}{\insrsid9898003
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid9898003 In order to add new radio button item in the tree you have to use the following function:
\par }\pard \ql \li360\ri360\nowidctlpar\faauto\rin360\lin360\itap0 {\ul\cf2\insrsid9898003 AddRadioButton();}{\insrsid9898003
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid9898003
\par Note that both of this functions require you to specify a unique ID of new option control. This way any
check box or radio button can be uniquely identified throughout the option tree control. In order to retrieve the ID of an option control that is specified by its handle to the tree item you can call:
\par }\pard \ql \li360\ri360\nowidctlpar\faauto\rin360\lin360\itap0 {\ul\cf2\insrsid9898003 GetItemFromID();}{\insrsid9898003
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid9898003 And if you need to get the handle of a tree item which corresponds to the given ID you can call:
\par }\pard \ql \li360\ri360\nowidctlpar\faauto\rin360\lin360\itap0 {\ul\cf2\insrsid9898003 GetIDFromItem();}{\insrsid9898003
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid9898003
\par Using first three function you can easily populate option tree control. You also can use all standard CTreeCtrl functions that are used in order to populate a tree control with items.
\par
\par We would like to emphasize one specific rule that applies to the way }{\b\insrsid9898003 COXOptionTreeCtrl}{\insrsid9898003 must be used which different from the standard approach. You}{\b\insrsid9898003 must not}{\insrsid9898003
explicitly change the image list associated with tree. We use our own internally in order to display check box and radio button images. But what if you want to display some images for control group items? }{\ul\cf2\insrsid9898003 AddControlGroup()}{
\insrsid9898003 function allows you to specify the image indexes for normal and selected state but these indexes must be returned by the following function which add new image to the internal image list:
\par }\pard \ql \li360\ri360\nowidctlpar\faauto\rin360\lin360\itap0 {\ul\cf2\insrsid9898003 AddImage();}{\insrsid9898003
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid9898003 Using this function you can add as many images as you want.
\par
\par Although it is not supposed to be modified outside but we still decided to provide a direct access to the internal image list. You may retrieve a pointer to it using
\par the following function:
\par }\pard \ql \li360\ri360\nowidctlpar\faauto\rin360\lin360\itap0 {\ul\cf2\insrsid9898003 GetImageList();}{\insrsid9898003
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid9898003 One of the possible use of the image list would be replacing of the images we use to display check box and radio button. At this moment the following images are predefined:
\par }{\insrsid9898003
\par }{\b\insrsid9898003 Index}{\insrsid9898003 \tab }{\b\insrsid9898003 Image}{\insrsid9898003 \tab
\par 0\tab unchecked box\tab
\par 1\tab checked box\tab
\par 2\tab unselected radio button\tab
\par 3\tab selected radio button\tab
\par \~\~\~\~\~\~\~\~\~\~\~
\par After the control is populated and displayed a user can expand and collapse control groups and change state of option items left clicking mouse or pressing down SPACE key.
\par \~
\par Whenever the state of an option item is changed the following notification will be send in form of WM_NOTIFY message:
\par }\pard \ql \li360\ri360\nowidctlpar\faauto\rin360\lin360\itap0 {\b\insrsid9898003 OTN_OPTIONCHANGED}{\insrsid9898003
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid9898003 If you handle the notification you have to cast NMHDR* object to }{\b\insrsid9898003 NMOPTIONTREE}{\insrsid9898003 * object.
\par NMOPTIONTREE structure provides info about the item, which state has been changed, the old state and the new state of the item. NMOPTIONTREE structure is declared as following:
\par
\par }{\b\i\insrsid9898003 typedef struct _tagNMOPTIONTREE
\par \{
\par \~\~\~ // standard header
\par \~\~\~ NMHDR hdr;
\par \~\~\~ // handle to the tree item (check box or radio button, which state
\par \~\~\~ // has been changed)
\par \~\~\~ HTREEITEM hItem;
\par \~\~\~ // item ID
\par \~\~\~ UINT uItemID;
\par \~\~\~ // old item state: OTITEM_UNCHECKED or OTITEM_CHECKED
\par \~\~\~ int nOldCheck;
\par \~\~\~ // new item state: OTITEM_UNCHECKED or OTITEM_CHECKED
\par \~\~\~ int nNewCheck;
\par \} NMOPTIONTREE, * LPNMOPTIONTREE;
\par }{\insrsid9898003
\par
\par
\par The state of any option item can be programmatically retrieved and changed using the following set of functions:
\par
\par }{\ul\cf2\insrsid9898003 SetCheck();
\par GetCheck();
\par GetCheckedRadioButton();
\par IsCheckBox();
\par IsRadioButton();
\par }{\insrsid9898003
\par
\par
\par And, finally, we provide the functionality to save to and load from registry option settings. Use these two functions to do that:
\par }\pard \ql \li360\ri360\nowidctlpar\faauto\rin360\lin360\itap0 {\ul\cf2\insrsid9898003 SaveState();
\par LoadState();}{\insrsid9898003
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid9898003 \~
\par }{\fs20\insrsid9898003
\par }}