Splitter containing a TreeView with TVS_EDITLABELS set: debug assertion failed w

I have a splitter window included inside a CScrollView.

This static splitter window contains a CTreeView set with TVS_EDITLABELS.

When I start to edit a label in the TreeCtrl, the label is selected and I get the input focus. If I click again inside the text control, OnEndLabelEdit gets called and then I get a debug assertion failed. Normal behaviour would be that OnEndLabelEdit shouldn't be called and the label selection should just disappear (that's what happens in Windows Explorer).

If I click outside of the text label, OnEndLabelEdit gets called and no problem.

If I type characters no problem either.

What I've seen so far is that on the second click, OnActivateView is first called on the ScrollView. This disactivates the TreeView and I suppose calls OnEndLabelEdit. Then OnActivateView is called for the TreeView (too late).

Does anybody have an idea of what's wrong and how to work around this problem?

Thanks for your help,

Pat
[1034 byte] By [Patricia Avigdor] at [2007-11-15 22:06:10]
# 1 Re: Splitter containing a TreeView with TVS_EDITLABELS set: debug assertion failed w
I just spent time debugging the same problem in a list control, but I believe the problem is the same in the tree control. What I did to fix it is to make sure that I called SetActivePane on the splitter window class before the label is edited.
Andy Howe at 2007-11-10 3:08:05 >
# 2 Re: Splitter containing a TreeView with TVS_EDITLABELS set: debug assertion failed w
Hello Andy,

Thanks for the answer.

But at which moment exactly do you call SetActivePane?

I tried to put it in the BeginEditLabel but it doesn't change anything.

Should I put it in the EndEditLabel or in the LButtonClick?

Thanks for your help,

Pat
Patricia Avigdor at 2007-11-10 3:09:05 >