|
|
Comments and Discussions
|
|
 |

|
Could you please clarify type of license of this control? I see that "there is no explicit license"
I'm going to change Microsoft standard control on faster tree view control.
Does it mean that "no explicit license" is similar to "The Code Project Open License (CPOL)" and "No claim of suitability, guarantee, or any warranty whatsoever is provided. The software is provided "as-is"."
Thank you in advance.
|
|
|
|

|
for myself I can say no limitations for copying but also no guarantee
hope RG will react soon
|
|
|
|

|
So long no feedback, I didn't imagine somebody is using it.
I've applied the CPOL, even if I'm an advocate of beer-ware
Thank you for using it.
|
|
|
|

|
Thanks for your answers and for a good tree control.
|
|
|
|

|
hallo boys,
looking at my company server for changes i found there are some in rgtreectrl.cpp
i will not update article's zip (now) but can send source by email (immediately)
mentioned changes (except some warning and casting improvements):
- 64bit related, like ptes = (TREE_EDIT_STRUCT*)GetWindowLongPtr( hwnd, GWLP_USERDATA);
- WM_MOUSEHWHEEL handling similar to WM_MOUSEWHEEL
- TVM_ENDEDITLABELNOW deals with cancel = if(wParam != 0)
- TVM_GETITEMSTATE handling
- non/unicode and ui automation needs both TVM_GETITEMA and TVM_GETITEMW in runtime
- CreateEx deals with #if (_MSC_VER < 1300)
|
|
|
|

|
When I tried insert item using LPSTR_TEXTCALLBACK instead of some text I got exception.
InsertItem(TVIF_PARAM|TVIF_TEXT|TVIF_STATE,LPSTR_TEXTCALLBACK,..) -> exception.
Is LPSTR_TEXTCALLBACK supported in InsertItem?
Thank you
|
|
|
|

|
i'm afraid it is not (i never used it)
|
|
|
|

|
I can not add check box style using this contorl.
Is adding check box possible?
Thank you~~
|
|
|
|

|
there is no special handling of checkboxes
(if there is any problem maybe it could be united with RGTreeWindowProc/case WM_CREATE or few short CRGTreeCtrl class functions)
|
|
|
|

|
Could you let me know the window style for adding check box..
I could not find proper style..^^
Thank you~
|
|
|
|

|
try have a look at TVS_CHECKBOXES (or TreeView_GetCheckState)
(personaly i never used it)
|
|
|
|

|
I tried it. But It does not work...
Thank you~
|
|
|
|

|
When I produce items over one million. Application requires over 250Mb for just creating tree control..
Did you have any solution for reducing memory.
Thank you for good article.
|
|
|
|

|
maybe you can have a look for virtual items in standard tree control
|
|
|
|

|
Just use TVI_FIRST insted of TVI_LAST - because of ListView uses single-linked list
|
|
|
|

|
How about RightTree? It aslo has the vertical scrolling problem with tooo many items, how to do with it?
Thanks!!
|
|
|
|
|

|
Does anyone have any suggestions for getting this control to work when you have MFC set to be statically linked in?
John Stanford
|
|
|
|

|
originaly sent by email 26 jan'06
hm, i just see problem is m_wndTreeCtrl1.m_hWnd isn't NULL already before
int nResponse = dlg.DoModal();
from
BOOL CTreeDlgApp::InitInstance()
looking in
CRGTreeCtrl::CRGTreeCtrl
it is ok (NULL)
just look from CTreeDlgDlg::CTreeDlgDlg already wrong (!= NULL)
this->m_wndTreeCtrl1
strange is look via
&this->m_wndTreeCtrl1
shows hWnd NULL
(when you look deeper at CTreeCtrl into you will see != NULL too)
in rgtree dll CWnd contains: CCmdTarget, m_hWnd
in main exe CWnd contains: CCmdTarget, classCWnd, m_hWnd
-> do you see the same?
this is only mention about i found in msdn:
RUNTIME_CLASS is yet another macro. It expands to &CWhatever::classCWhatever. So, for example, there's a classCWnd, classCDialog, classCListCtrl, and so on—the CRuntimeClass objects for these classes.
i'm afraid for today it is all i know
and maybe the best you will search (or put more detained question) into general programming forum(s)
http://www.angelfire.com/sk3/scsp/rozne.html
|
|
|
|

|
Hi,
I'm interested in using your class and was wondering if there was a later version available that addresses any of the issues in the Todo List or any bugs reported. If so, where can I get it from ?
Thanks in advance!
|
|
|
|

|
unfortunately this control is already longer time "as is" without news
any improvements are welcomed but from my side (except critical bugs) less probable
|
|
|
|

|
Hello, has anyone tried building this on VS 2003?
The error messages I get are:
Compiling...
RGTreeCtrl.cpp
RGTreeCtrl.cpp(3830) : error C2660: 'CTreeCtrl::CreateEx' : function does not take 11 arguments
RGTreeCtrl.cpp(3840) : error C2660: 'CTreeCtrl::CreateEx' : function does not take 8 arguments
thanks!
|
|
|
|

|
BOOL CRGTreeCtrl::CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
int x, int y, int nWidth, int nHeight,
HWND hWndParent, HMENU nIDorHMenu, LPVOID lpParam)
{
m_bCreated = true;
#if (_MSC_VER < 1300)
return CTreeCtrl::CreateEx(dwExStyle, lpszClassName, lpszWindowName, dwStyle, x, y, nWidth, nHeight,
hWndParent, nIDorHMenu, lpParam);
#else
return CWnd::CreateEx(dwExStyle, lpszClassName, lpszWindowName, dwStyle, x, y, nWidth, nHeight,
hWndParent, nIDorHMenu, lpParam);
#endif
}
BOOL CRGTreeCtrl::CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd, UINT nID,
LPVOID lpParam)
{
m_bCreated = true;
#if (_MSC_VER < 1300)
return CTreeCtrl::CreateEx(dwExStyle, lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, lpParam);
#else
return CWnd::CreateEx(dwExStyle, lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, lpParam);
#endif
}
|
|
|
|

|
Just replace the part of code at the method DoScroll to the following:
switch(nScrollCode)
{
case SB_THUMBPOSITION:
case SB_THUMBTRACK:
//nPos = nPosition;
{
SCROLLINFO info = {0};
info.cbSize = sizeof( SCROLLINFO);
info.fMask = SIF_TRACKPOS;
GetScrollInfo(ptms->hwnd, ScrollBar, &info);
nPos = info.nTrackPos;
}
break;
case SB_LINELEFT:
nPos--;
break;
case SB_LINERIGHT:
nPos++;
break;
case SB_PAGELEFT:
nPos -= vCount - 1;
break;
case SB_PAGERIGHT:
nPos += vCount - 1;
break;
}
|
|
|
|

|
can you add short description of original problem?
thanks
|
|
|
|

|
fro MSDN:
The high-order word specifies the current position of the scroll box if the low-order word is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, this word is not used.
Note that the WM_VSCROLL message carries only 16 bits of scroll box position data. Thus, applications that rely solely on WM_VSCROLL (and WM_HSCROLL) for scroll position data have a practical maximum position value of 65,535.
However, because the SetScrollInfo, SetScrollPos, SetScrollRange, GetScrollInfo, GetScrollPos, and GetScrollRange functions support 32-bit scroll bar position data, there is a way to circumvent the 16-bit barrier of the WM_HSCROLL and WM_VSCROLL messages. See GetScrollInfo for a description of the technique.
So when I inserted > about 65532 plain items and when tried to scroll with drag-n-drop scroll box there was an overflow in high-word of wParam.
|
|
|
|

|
First of all, your tree control is great. With only a few simple changes I have your tree control in my program and all of my speed issues are gone.
My question is very basic. I added your control to my program dynamically but I want to learn how I add the list using the resource editor (like the sample program did). In the resource editor you added a CListCtrl but somehow it was being handled by your tree control code. Could you outline the steps for me to accomplish this.
Thanks.
Ryan
|
|
|
|

|
1.
into resource editor insert common tree control (sorry, i see no list one)
2.
use class wizard to create (dialog) member based on it (CTreeCtrl) (it will change .h and .cpp files linking dialog-item id with class using DDX_Control)
3.
manualy change its class from CTreeCtrl to CRGTreeCtrl (with manual adding of necessary #include)
(another possibility how to do 2nd is own subclassing, you can find articles about at this server: http://www.codeproject.com/info/search.asp?target=subclassing&Submit1=+Search+&st=tt&qm=all)
t!
|
|
|
|

|
I am very interested in the faster tree control. However, we need a tree control that supports multiple selection. I was wondering if Tibor's faster tree control supports this, and if not, what would it take to do so? Currently we have been using the SECTreeCtrl from Rogue Wave, but it is very buggy and very slow. Also, it is based on the windows list control common control, which supports the multiple selection, whereas I believe the windows tree control common control does not.
Robert
|
|
|
|

|
yes, RGTree supports multi-selection the way system tree-ctrl does
it must be handled by changing item's TVIS_SELECTED flag (instead of SelectItem what can unselect too)
there already are comfort classes created, just derive them from RGTreeCtrl
(i personaly prefer (slightly modified) TreeCtrlEx from http://www.techsoft.no/bendik[^])
t!
|
|
|
|

|
now i found that if project contains .def file
and debug output file name differs to release
than produced debug implib contains release dll name inside
|
|
|
|

|
We had the same problem with the Microsoft tree control. We found that deleting entries was very slow. The "fix" for us, if you could call it that, was to collapse the parent node of the node that was being deleted. It sped it up considerably for the application we were using.
This may not be an option for everyone, but it's worth considering.
|
|
|
|
|

|
Another trick:
In our case, the tree view had 20,000+ elements. We ended up creating a new tree view over the existing one, hiding it, and the in the idle processor we deleted the elements and finally deleted the control.
It worked great.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|

|
I realize this is a two-year-old discussion, but I'm sure someone will find my idea useful.
Another trick someone might use is to not load all the data into the control until it is first expanded. You will want to special-case certain keypress combinations like Ctrl-* (e.g. the "expand all" feature of tree controls could be made to only expand 5 levels deep at a time). That handles the adding case and most delete cases as well. You also only run into the delete issue if someone expands every node in the tree.
|
|
|
|

|
whether i do call the SetBkColor or not, the back-color keeps in white.
you may remove a line from OnPaint function:
ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rcUpdate, NULL, 0, NULL);
|
|
|
|

|
can't repeat
SetBkColor() called before ExtTextOut() takes system settings - at mine gray color
maybe you have own OnPaint()?
happens with example project?
what when you give fixed color before?
t!
|
|
|
|

|
i think i don't catch your meaning exactly.
what i do had is ONLY REMOVE the ExtTextOut call. i don't modify much.
|
|
|
|

|
unfortunately makes me no good in some situations
(own OnPaint into bitmap filled by CWnd::DefWindowProc(WM_PAINT, (WPARAM)dc.m_hDC, 0);)
t!
|
|
|
|

|
i am having TreeCtrl which have check box can any body tell me how to get check box click event or
what iwan to do is to select the child notes when theparent node is selected???
can any oyd help me????????????
|
|
|
|

|
Simple search and replace to support flat scroll bars.
In the RGTreeCtrl.cpp file:
1) Replace all GetScrollInfo with FlatSB_GetScrollInfo
2) Replace allGetScrollInfo with FlatSB_SetScrollInfo.
If the application calls InitializeFlatSB( hTree ) after the creation of the tree control, then the standard scroll bars are flat. If the InitializeFlatSB() routine is not called, the scroll bars are the standard ones.
Would be nice to incorporate this into the base code.
Doug Garno
ddgarno@earthlink.net
|
|
|
|

|
i had got a scrollbar library called CoolSB(is this same to the FlatSB?). i study the FasterTreeCtrl just because of that library couldn't handle OnSize well. and i do as your directive, it could not hide/show right when sizing.
i do call CoolSB_ShowScrollBar as: { CSize szView; QueryTreeViewSize (###, &szView); CRect rcClient; GetClientRect (hwnd, &rcClient); if (rcClient.Width() < szView.cx) { CoolSB_ShowScrollBar (hwnd, SB_HORZ, true); } else { SendScrollMessage (hwnd, WM_HSCROLL, SB_LEFT, 0); CoolSB_SetScrollPos (hwnd, SB_HORZ, 0, false); CoolSB_ShowScrollBar (hwnd, SB_HORZ, false); } if (rcClient.Height() < szView.cy) { CoolSB_ShowScrollBar (hwnd, SB_VERT, true); } else { SendScrollMessage (hwnd, WM_VSCROLL, SB_TOP, 0); CoolSB_SetScrollPos (hwnd, SB_VERT, 0, false); CoolSB_ShowScrollBar (hwnd, SB_VERT, false); } } static bool QueryTreeViewSize (TREE_MAP_STRUCT *ptms, SIZE *pszView) { if (NULL==ptms || NULL==pszView) return false; pszView->cx = ptms->nMaxWidth > 0 ? ptms->nMaxWidth - 1 : 0; //NOTE: nVisibleItemCount without subtract pszView->cy = ptms->nVisibleItemCount > 0 ? ptms->nVisibleItemCount : 0; pszView->cy *= ptms->nItemHeight; return true; }
|
|
|
|

|
Hi,
I needed my own compare function which handles German umlauts right. There is already a function to set your own function but only in the template class. I have made the following extensions to CRGTreeCtrl:
in RGTreeCtrl.h:
// make the prototype known
typedef int (CALLBACK* CompareFunc)( LPARAM lParam1, LPARAM lParam2);
class RGTREECTRL_API CRGTreeCtrl : public CTreeCtrl
{
...
public:
...
void SetCompareFunc( CompareFunc newFunc);
};
in RGTreeCtrl.cpp:
void CRGTreeCtrl::SetCompareFunc( CompareFunc newFunc)
{
TREE_MAP_STRUCT *ptms = (TREE_MAP_STRUCT*) ::GetWindowLong(GetSafeHwnd(), GWL_USERDATA);
ptms->rgTree.SetCompareFunc(newFunc);
}
The cast is quite ugly - is there another way to do it?
Ciao,
Andreas
|
|
|
|

|
i afraid no
but when you will implement TVM_SORTCHILDRENCB into RGTreeWindowProc() you will use already existing one
t!
|
|
|
|

|
That would be the best solution, I didn't know that you can set your own compare function.
A problem is that your function expects 2 parameters and Microsoft's 3 - is it okay to extend your compare function? If yes I would add the functionality and make the necessary changes.
|
|
|
|

|
if i understand it well there are this sort cases:
TVM_INSERTITEM/TVI_SORT - rgtree not implemented (who wants?), always using "system" Compare
TVM_SORTCHILDREN - always using "system" Compare
TVM_SORTCHILDRENCB - you define "client" 3 params function (of course you can unite it if it will simplify implementation)
t!
|
|
|
|

|
The default procedure for the edit control will beep when pressing RETURN or ESCAPE. The tree considers these as valid keys and should not beep when processing. To remove the beep return 0 (zero) in the WM_CHAR handler if the key was RETURN or ESCAPE. This tells windows that the message was handled and no further processing is needed. Here is what I've done.
At the bottom of the WM_CHAR message code I added
if( wParam == VK_RETURN || wParam == VK_ESCAPE )
return( 0 );
Doug Garno
ddgarno@earthlink.net
|
|
|
|

|
Parent receives the TVN_ENDLABELEDIT message when the user presses ESCAPE or RETURN and then also when the edit control looses focus. Parent should only receive one notification that the user has terminated the editing process. Possibly set a flag in the WM_CHAR handler of the edit procedure and when the WM_KILLFOCUS handler sends the notification, check the flag and send the proper termination state.
Doug Garno
ddgarno@earthlink.net
|
|
|
|

|
maybe it is enought to switch
ptms->hItemEditing = NULL;
before
ShowWindow( ptms->hWndEdit, SW_HIDE);
in EndEditLabelNow()
(ShowWindow causes WM_KILLFOCUS call what with already NULL hItemEditing will be filtered in EndEditLabelNow() start)
but needs to test
t!
|
|
|
|

|
When setting up the NMTVDISPINFO structure for the parent notify, ptms->hItemEditing is used which is not set until after the parent responds. Should use the lParam of the message which is the item that the user want's to edit.
Doug Garno
ddgarno@earthlink.net
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
An article about an open source and free fast tree control
| Type | Article |
| Licence | CPOL |
| First Posted | 18 Aug 2001 |
| Views | 285,662 |
| Bookmarked | 83 times |
|
|