Click to See Complete Forum and Search --> : Tree Control Selections??


Mindy
May 19th, 1999, 09:46 AM
I have a tree control that is dynamically created on a dialog box. When you select an item, the highlight color moves to the new item, but the selection rectangle stays on the old one until the mouse key is released. If you are trying to select a new one and you move the mouse while the key is down, the highlight color moves back to the old selection. The effect can be best seen when you deliberately go slowly. My only guess is that there is some flag that is out of place. Anyone have a clue as to why this happens? I can't reproduce the problem in other software, so it seems that it is definitely something I am doing and not just a property of the tree control.

Here is how I create it:

m_treeCtrl.Create(WS_VISIBLE | WS_CHILD | TVS_HASLINES | TVS_LINESATROOT |
TVS_HASBUTTONS | TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,
rectTreeCtrl, this, IDC_CM_CONFIG_TREE);
m_treeCtrl.SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);




Any help would be greatly appreciated!
Mindy

May 19th, 1999, 11:34 AM
Keep in mind that tree controls (unlike list controls) differentiate between the "Selected" item, and the current "Drag/Drop" target. Theoretically, the "selected" item keeps the focus, while the "Drag/Drop" target only has the focus if the mouse is currently over it. You may be seeing strange hilighting behavior as the tree control tries to automagically highlight potential Drag'n'Drop nodes. If you are not planning to use Drag'n'Drop on your tree control, turn it off; this may eliminate your problem.

Cheers!
Humble Programmer
,,,^..^,,,

Mindy
May 19th, 1999, 11:55 AM
Wa-hoo! This worked! Thank you so very much!!!

Mindy