GT
2010-05-20 14:56:42 UTC
Short version:
on a CDialog based dialog, I have a CTreeCtrl based control that contains a
flat list of HTREEITEMs, each with a checkbox. When I add items to it during
OnInitDialog, none of the checkboxes appear ticked, even though I set some
of them checked and stepping through the code suggests that they should be.
Calling the same code dynamically after the OnInitdialog has finished and
the items do get ticked.
Help!
Long version:
I have a dialog in my application that allowed the user to turn on and off
various options. There are 2 tree controls on the dialog. The tree on the
left has fixed content - an entry for each of the 8 areas of my application
and is populated in my OnInitDialog. The tree on the right is populated on
demand and contains a flat list of entries relevant to any one section of my
application. Each entry on the right hand tree has a checkbox. My current
set of checks is defined in a 2d bool array called m_bColumnView. All are
CTreeCtrl + CDialog derivatives.
In my OnInitDialog, I populate the tree on the left and that works OK (there
are no checkboxes). I also default the tree on the left to the first
section, which triggers my OnTvnSelchangedTree event operation, which does a
few basic checks, then calls my PopulateList() operation to populate the
tree on the right, thereby giving the dialog some default entries. The
PopulateList method creates a mask:
UINT iMask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
Then adds a series of tree items with checkboxes, therefore, I have a series
of lines like this:
m_treeRHS.SetCheck(m_treeRHS.InsertItem(iMask, "Name", 2, 2, NULL, NULL,
col_name, TVI_ROOT, NULL), m_bColumnView[m_iTreeItem-1][col_name]);
When I click through the sections on the left the tree on the right is
populated by PopulateList() and behaves perfectly, but when I trigger
PopulateList() during my OnInitDialog, the tree on the right is populated
with all the right entries, but no checkboxes are tickes. I have stepped
through the code and they definitely should be ticked, they just don't
appear ticked on the screen.
Any idea whats going on??
on a CDialog based dialog, I have a CTreeCtrl based control that contains a
flat list of HTREEITEMs, each with a checkbox. When I add items to it during
OnInitDialog, none of the checkboxes appear ticked, even though I set some
of them checked and stepping through the code suggests that they should be.
Calling the same code dynamically after the OnInitdialog has finished and
the items do get ticked.
Help!
Long version:
I have a dialog in my application that allowed the user to turn on and off
various options. There are 2 tree controls on the dialog. The tree on the
left has fixed content - an entry for each of the 8 areas of my application
and is populated in my OnInitDialog. The tree on the right is populated on
demand and contains a flat list of entries relevant to any one section of my
application. Each entry on the right hand tree has a checkbox. My current
set of checks is defined in a 2d bool array called m_bColumnView. All are
CTreeCtrl + CDialog derivatives.
In my OnInitDialog, I populate the tree on the left and that works OK (there
are no checkboxes). I also default the tree on the left to the first
section, which triggers my OnTvnSelchangedTree event operation, which does a
few basic checks, then calls my PopulateList() operation to populate the
tree on the right, thereby giving the dialog some default entries. The
PopulateList method creates a mask:
UINT iMask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
Then adds a series of tree items with checkboxes, therefore, I have a series
of lines like this:
m_treeRHS.SetCheck(m_treeRHS.InsertItem(iMask, "Name", 2, 2, NULL, NULL,
col_name, TVI_ROOT, NULL), m_bColumnView[m_iTreeItem-1][col_name]);
When I click through the sections on the left the tree on the right is
populated by PopulateList() and behaves perfectly, but when I trigger
PopulateList() during my OnInitDialog, the tree on the right is populated
with all the right entries, but no checkboxes are tickes. I have stepped
through the code and they definitely should be ticked, they just don't
appear ticked on the screen.
Any idea whats going on??