I am beginner to VC++. Now I want to develop an application where window divided into two parts. left side i am having tree view and right side display information.
I already implemented tree view using SDI application (CTreeView).
Now I want to implement a tree in CFormView. How can i write a tree implementation in CForm View.
Please suggest me the solution. Also If you have any references related to this please send me.
Thanks in advance........
To invent something, you need a mountain of junk in your mind.
---------------------Thomas alva edison
I'm not sure if this is the appropriate place to put it, as my question is regarding C++, but for OWL rather than MFC. Anyways, down to the problem:
I'm maintaining some legacy code which involves a multi-line listbox. The contents of this listbox are loaded in through the EvDrawItem function. The EvDrawItem gets called repeatedly. While selecting an object, the cells in the listbox are selected one at a time too, and we are manually painting it in (not sure if this is the right way to do it). This becomes noticeable only when the items are long.
Now, here's the biggest part of the problem: when double-clicking on an item, we are supposed to pop up an edit box. While this does happen, the double-clicking is seen to cause the item to do cycles of "select, select, de-select, select"...about 50 (each cycle is made up of 4 EvDrawItems) times (is this normal???).
With some research, I do feel that I should probably make use of the setredraw and invalidate functions, but I'm not sure where's the best place to put these codes in so that they propagate through the rest of the program where similar listboxes are used.
Also, since the draw and the insertions are handled together, would suppressing redraw affect how the list loads up?
Thank you for your response. Yes, I've already looked at that, and I do feel it would help, just trying to find the best place to put it. However, I'm still not sure why it does the "select, select, deselect, select" thing so many times on a double-click. I would suspect it's not a normal behaviour even without disabling the redraw.
Upon further investigation, it turns out that the child control is receiving messages asking it to traverse through all the lines in the selected item. For each of the lines, it receives the following itemAction and itemState (in this order):
1. ODA_SELECT with ODS_SELECTED
2. ODA_FOCUS with ODS_DEFAULT | ODS_SELECTED
3. ODA_FOCUS with ODS_SELECTED
4. ODA_SELECT with 0
Unfortunately, events 1 and 4 cause the program to select/deselect all the rows in the multi-row item, which results in huge flickering. Fortunately, our redraw function does nothing on events 2 and 3 . So right now, my question is:
1. Is this traversing of all the items something that was implemented in the TListBox base class or are we telling it to do that somewhere in our code?
2. Also, is it better to override this traversing to do one big redraw or to override the handling to only select, deselect, then re-select each row?