Originally posted by: Srinivas Bandi
I have a tree control with items added. When I set the selected state, it is expanded but not highlighted.
Originally posted by: Ravi Kumar R
Now the child windows (tree control, header control) of the
Reason:
Fix:
File : TLFrame.cpp
// smoothly scroll the tree control
CRect m_headerRect;
m_tree.m_wndHeader.SetWindowPos(&wndTop, m_tree.m_nOffset, 0,
max(StretchWidth(m_tree.GetColumnsWidth(),m_treeRect.Width()),m_wndRect.Width()), m_headerRect.Height(),
SWP_SHOWWINDOW);
Simulating the problem:
1) Resize the window so that the horizontal scroll bar
appears (resize so that 2 columns are visible).
2) Scroll toward the extreme right using the scroll bar.
3) Resize the window so that the scroll bar dissapears.
TLFrame is not redrawn (or visible) properly.
While scrolling, the header control is moved using the -ve
co-ordinates and the tree control is scrolled.
Once the scrolling is done and the immediate resizing of
the window is done, the header control and the tree control
is not aligned (moved and scrolled) wrt the new size of the
window.
In CTLFrame::OnSize(UINT nType, int cx, int cy) function
and after call to "m_tree.ResetVertScrollBar();"
i.e after line number 439. Insert the below code. This
code is taken from the same file and from the
CTLFrame::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
function.
{
// Reset the header control position and scroll
// the tree control as required.
int m_nCurPos = m_horScrollBar.GetScrollPos();
m_tree.m_nOffset = -m_nCurPos;
{
CRect m_scrollRect;
m_tree.GetClientRect(&m_scrollRect);
m_tree.ScrollWindow(m_nCurPos, 0, &m_scrollRect, &m_scrollRect);
}
m_tree.m_wndHeader.GetWindowRect(&m_headerRect);
CRect m_wndRect;
GetClientRect(&m_wndRect);
}
Originally posted by: Dan Querciagrossa
I'm gettin some strange things happening with the horizontal scroll bar. I Have the TLFrame in a CView. The Frame is resized any time the view is resized so that it fills the entire view. When the view is expanded downward, the horizontal scrool bar is redrawn at the bottom just fine. But when you click in the tree at the original position of the scroll bar, a second bar appears, over the top of the tree item in that spot. I can't seem to get that scroll bar to ever go away completely. Other than that though, this is a great control really a very useful way to represent some types of data. Thanks
ReplyOriginally posted by: VU KHAC TRI
How does the window contains this CTFrame detect that there is a change of selected elements.
Thanks for help.
Tri.
Originally posted by: kwang young kim
close program , exception COMCTL32.Dll Message...!!!
How can i do this exception?
please....
ReplyOriginally posted by: Charles Logon
It is great!
How do you add multiple selections to the control?
Charles
ReplyOriginally posted by: Kalyani
I have used this ctrl in one of my programs. I have to write some code when a mode is doubleclicked in the
treeview. I tried adding OnDblClk event in CNewTreeListCtrl. The code in that is getting executed twice...
Can u help me...
Originally posted by: Roland Vanputten
Try the following in the sample: expand all branches of the first item. Then make the frame as small as possible. The original scrollbar of the treectrl will appear, so now we have two horizontal scrollbars with strange behaviour.
I'm busy creating my own extended multi-column tree-control (with this sample as inspiration source) and tried to solve this problem. It seems to work if you handle the ON_WM_WINDOWPOSCHANGING message and hide the scrollbar there.
void CNewTreeListCtrl::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
{
CTreeCtrl::OnWindowPosChanging(lpwndpos);
ShowScrollBar(SB_HORZ, FALSE);
}
Originally posted by: Christian Skovdal Andersen
I think that David Lantsman's control is working really good.
However I have a suggestion to the "CTLFrame::Initialize()" method
replace this line of code
With these lines of code.
HBITMAP hBitmap ;
m_tree.m_cImageList.Create(16, 16, ILC_COLOR8, 0, 0);
Hi everybody
m_tree.m_cImageList.Create(IDB_HEADER, 16, 10, RGB(192,192,192));
CBitmap *pBmp ;
hBitmap = (HBITMAP)::LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_HEADER), IMAGE_BITMAP, 0, 0,
LR_LOADMAP3DCOLORS|LR_LOADTRANSPARENT|LR_CREATEDIBSECTION);
pBmp = CBitmap::FromHandle(hBitmap);
m_tree.m_cImageList.Add(pBmp, RGB(255,0,255));
The code above makes the small sort arrows in the header control, the same colour as the other windows
controls no matter the colour scheme that used.
Originally posted by: Mike Weiss
if(!VerticalScrollVisible())
Also in CNewTreeListCtrl::DeleteItem I'm thinking that you may
The author should really clean up this sample...the use of "m_" on non-member variable is really
Here's some fixes for this artical...I ended up trying to use
this tree for something I was prototyping...but decided it
had too many problems for a real project...but heres some fixes:
In TLFrame.cpp find CTLFrame::ResetScrollBar() change lines 191 and 195
See the code below...This will fix the resize
// i.e. vertical scroll bar isn't visible
{
//fixed this line below (line 191)
m_horScrollBar.SetWindowPos(&wndTop, 0, m_wndRect.Height()-m_barRect.Height(),
m_wndRect.Width(), m_barRect.Height(), SWP_SHOWWINDOW);
}
else
{
//and here too (line 195)
m_horScrollBar.SetWindowPos(&wndTop, 0, m_wndRect.Height()-m_barRect.Height(),
m_wndRect.Width() - GetSystemMetrics(SM_CXVSCROLL), m_barRect.Height(), SWP_SHOWWINDOW);
}
want to delete the pItem pointer...
REALLY confusing, the useless #include, and the bugs makes this otherwise good approach useless!