August 3rd, 1999, 02:40 PM
CTreeCtrl display problems
I am having problems with my CTreeCtrl that is displayed in a FormView. I am using the +/- buttons to allow expansion/colapse of the tree branches. It is used with a tab control and other controls, for reference. *grin*
The problem is that when I have several branches expanded to the point where I get a vertical scroll bar and a child node is selected, the control does not properly refresh when the +/- button is clicked to collapse the branch and the scrollbars go away (the area below the newly selected parent node is grey). If I have a parent node selected when it is collapsed, the display updates correctly.
Also, if I have the tooltips enabled for the control and I click and hold on the scroll bar to drag it up and down, I get grey bars on the control if the cursor crossed into the Tree client area and a tool tip temporarily displays.
I have tried to turn the control's redraw off during expansion/collapse. That clears up the grey display problem, but the scrollbar area and frame do not refresh then. I tinkered with the parent window's refresh as well, and got even closer...but now I am stumped. Close but no cigar. *grin*
Anyone have any ideas or suggestions?
(Note: my FormView is a child window in a CSplitterWnd, in case that may be a factor)
Thanks for the time.
November 13th, 2003, 12:13 PM
hehe....I'm going to bring this post back from the dead.
I am having the exact same problem as this person. I have a tree control inside of a docking window, and it is not properly refreshing when the scrollbars are present and a child item is selected. As soon as teh node is collapsed, the control display goes wacky, and doesn't refresh correctly. This post described it so well that I revived it instead of typing a new one. Does anyone have any ideas?? I'm really stumped on this one.....i've been messing with it for hours.
November 13th, 2003, 12:30 PM
I've heard of that strange problem a few times, but never managed to reproduce it myself. Although more a workaround than a solution, the following thread may help.
November 13th, 2003, 01:27 PM
Thanks for your reply!
I finally got it figured out!
November 13th, 2003, 01:43 PM
Does it mean the info from the other thread fixed it? I'm interested in this, as I've heard of that phenomenon more than once without ever seeing it, and I would like to figure out the cause.
Originally posted by alake
I finally got it figured out!
November 13th, 2003, 02:00 PM
Sorry, I should have been more specific in what the cause was
I tried your suggestion, and it didn't seem to help. I searched the web for more info, and found this: http://www.experts-exchange.com/Prog..._20254217.html
Basically, this guy had the same type of problem. In the post, someone mentioned that it could have to do with the "z-order". From what I gather, this has something do do with the order in which controls are displayed or refreshed on a dialog...it also has something to do with the selection order of the controls when the tab key is pressed.
In my case, I have a dialog with multiple controls that are shown or hidden with a tab control. As the reply directed, I went into the dialog editor and played with the tab order. And suddenly it worked!! Both tree controls redraw perfectly now. I honestly don't understand exactly what causes this problem. But somehow, playing with tab selection fixed it.
thanks again for your help....and if you have any further input on what causes this problem I'd love to hear it! It is definately very odd.
Last edited by alake; November 13th, 2003 at 02:20 PM.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!