|
If you don't want to link your project with TurboDLL.dll but want to create a standalone executable file, here's the steps to follow :
1- Include the following Bitmaps in your ressource tree :
IDB_TREELIST_BITMAP (res\BM_BKGND.BMP)
IDB_TREELIST_CHECK (res\bm_checkbox.bmp)
IDB_TREELIST_DISABLE (res\bm_bkgnd2.bmp)
IDB_TREELIST_HEADER (res\bm_def_head.bmp)
IDB_TREELIST_LOCK (res\bm_lockbox.bmp)
IDB_TREELIST_SORT (res\bm_def_sort.bmp)
IDB_TREELIST_TREE (res\bm_def_tree.bmp)
2- Include the following Cursors in your ressource tree :
IDC_CURSOR1 (res\cursor1.cur)
IDC_CURSOR_BUTTON (res\cur_button.cur)
IDC_CURSOR_CHECK (res\cur_checkbox.cur)
IDC_CURSOR_CROSS (res\cur_cross.cur)
IDC_CURSOR_DROP (res\CUR_DROP.CUR)
IDC_CURSOR_HORZ (res\CUR_HORZ.CUR)
IDC_CURSOR_LOCK (res\cur_lockbox.cur)
IDC_CURSOR_SIZE (res\CUR_SIZE.CUR)
IDC_CURSOR_SPLIT (res\cur_split.cur)
IDC_CURSOR_STOP (res\CUR_STOP.CUR)
IDC_CURSOR_VERT (res\CUR_VERT.CUR)
3- Add this to "stdafx.cpp"
#include "./TreeListResource.h"
CTreeListResource::CTreeListResource()
{
}
CTreeListResource::~CTreeListResource()
{
}
4- Add these lines to "stdafx.h" to turns the code into a non DLL/exported one :
#undef AFX_EXT_CLASS
#define AFX_EXT_CLASS
#include "./TurboDLL.h"
5- In "TurboDLL.h" uncomment the following line to allow the use of CArray :
#include <<Afxtempl.h>>
And you're done !
Kochise
In Code we trust !
|
|
|
|
|
Hi Kochie,
I'm trying to follow your suggested solution but its not working for me.
Could you possibly post full projects (both turboDemo and turboDLL) which runs turboDemo statically linked.
Maybe then I can see where I'm going wrong.
If it matters, I'm using VS2008.
Thanks. ...Laurie:{)
|
|
|
|
|
Hello,
First I would Like to thank you for this control.
I do not understand how to let the user edit a value in a subitem of the list. If someone would explain how to do this I would appreciate it very much!
I have tried to add an nLButtonDblClk() to my subclass of the control and then call BeginModify() with the item and col that the user has dubble clicked in. But nothing happens....
Please Help!
Mike Eriksson
--
|
|
|
|
|
|
I'm very interesting in your idea.
Could you public your source code that supports in-list editing ?
Thanks in advance !
http://img143.imageshack.us/img143/2939/tung1np.gif
|
|
|
|
|
There seems to be some support for sorting but I am not sure enough to make it actually sort items as they are being inserted. Any ideas or clues?
Little Ian
|
|
|
|
|
Hello TigerX
Thanks for the control. It is great but for one thing. It says it fully supports CListCtrl and yet there is no SortChildren method. Is there another way I can sort child tems of a particular node?
Jordan
Ashes to ashes, DOS to DOS.
|
|
|
|
|
Hello,
When I include the files in my project, I get about 252 warnings: inconsistent dll linkage
Any solutions?
Thanks
AK
|
|
|
|
|
|
i can't turbodll.dll in asp.net control. i hope you hepl me!Thanks you very much!
Lam thank you!I hope you sucessful
|
|
|
|
|
Assuming you're not joking, I recommend buying a book on ASP.NET. There's no way a C++ control, written for windows, can work in ASP.NET. Even if it was written for C# or VB.NET, it wouldn't work, it doesn't generate HTML, it's not a web control.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
How can I set color if a specific subitem of a treectrl?
I can only change color of an item, that means a line of a treectrl. I want to change color of a specific subitem of this line.
Thanks
Regards
Catia
|
|
|
|
|
listitem add tow var: m_crBack m_crText
In CTreelistCtrl ->DrawItem
pDC->SetTextColor( pItem->m_crItemTextColor ); //TangQin modify
void CTreeListCtrl::DrawItems( CDC* pDC, CRect rcClip )
.
.
.
if( !(CWnd::GetStyle()&WS_DISABLED) )
{
if( m_dwStyle&TLC_DOUBLECOLOR )
{
crBkColor= pShowItem->m_crItemBkColor;
|
|
|
|
|
Hi there,
first: great control!
DeleteColumn(iCol) runns into Assertion
ASSERT( m_pRootItem->m_pChild == NULL );
at TreeListCtrl.cpp line 3419
but why?
Can anyone describe how to delete a column without running into this assertion?
What is m_pRootItem->m_pChild?
What is if m_pRootItem->m_pChild == NULL?
Sorry for posting here, but the Documentation is a bit weak ;o)
cheeerz,
vertex
_
__ _____ _ __| |_ _____ __
\ \ / / _ \ '__| __/ _ \ \/ /
\ V / __/ | | || __/> <
\_/ \___|_| \__\___/_/\_\
|
|
|
|
|
|
First, thanks a lot for such a great work. I really appreciate your efforts.
I have some comments:
I downloaded the demo project from the .fr site and did some modifications:
- Dialog border to Resizing
- Moved the 'static text status labels' from the bottom to top so that tree-resizing logic/code is simple.
- Added CTurboDemoDlg::OnSize() message, which resizes the tree:
void CTurboDemoDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
if(!m_ctrlTreeList.GetSafeHwnd())
{
return;
}
CRect rectClient;
GetClientRect(&rectClient);
CRect rectTree;
m_ctrlTreeList.GetWindowRect(rectTree);
ScreenToClient(rectTree);
int iSpacing = 10;
m_ctrlTreeList.SetWindowPos(
NULL,
rectTree.left,
rectTree.top,
rectClient.Width() - 2 * iSpacing,
rectClient.bottom - rectTree.top,
SWP_NOZORDER
);
}
- Commented the FeedTree() call from OnInitDialog()
Now when you resize the dialog, there is a lot of flicker in the tree. The flicker occurs regardless of whether the tree is empty or filled. I checked the Explorer's tree control (SysTreeView32) and there is a lot of flicker there, too. System's list control (SysListView32), however, doesn't have any flicker even when you resize it.
Anyways, is there anyway you can reduce / eliminate the flicker?
|
|
|
|
|
When there is few items in the CTreeList and vertical bar is not dispalyed, then moving columns larger to the CTreeList window, lead to the CTreeList window to disappear instead of displaying the horizontal scroll bar !!!
If anyone have a solution to correct this bug ...
NB : have this bug only if compiled in release mode !
|
|
|
|
|
I Find this bug too
toyclub@sina.com
|
|
|
|
|
How about incooperating all suggested enhancements from this messageboard and update the sources ?
Thank you.
yoko
|
|
|
|
|
"OK guys, hands in the air, gimme the money !"
With the nice but inconsistent starting, here I'm introducing myself : Kochise, to serve you. Well, enough silly bablings, I just wanted to tell you all that I finally got solved many problems found in the original TigerX's component. I also added all suggestions from all the previous posts, and tweaked things tightly. Here is what you get :
- The demo application now shows Delete/Insert/Expand time
- You can refeed the tree to see the time spent in the process
- The resizing now works like expected
- The component still flickers (not managed to avoid this with a double buffer)
- The runtime delay got in the release mode is (almost) definitively solved
- Added auto-blocking refresh when inserting/deleting a lots of items
- Configured the release mode to create debug files
- ...
Now before you proceed to download the new version, let me explain how I solved the ENORMOUS delay everyone experienced in release mode. For this I had to get a code profiler to spot where the CPU was spending, sorry, wasting time. I first checked CodeProject's availability of such a tool, and found one :
http://www.codeproject.com/cpp/profiler.asp
This was exactly what I needed, showing several informations, time spent in each function, etc... But after having downloaded the project binaries, get a look at the source code and the example program, it appeared I had to instrument the whole source code before getting it to outpot profiling logs. It was no worth wasting my time for this, as I had then to remove all profiler dependencies from the source code to release it afterward.
So I took another choice. In my previous jobs, in embedded, I worked with hardware real-time code profilers such the Lauterbach :
http://www.lauterbach.com/
These pieces of excellence are just expensive units, but that perform exactly what we needs, and able to display to the coder where the code is currently dead locking, what is the memory consumption, etc... All of this in a in-situ prototype ! With flashed ROM ! How convinient ! Thus I got a look on the net to find something similar for Windows, and found one that may fits my needs :
http://www.glowcode.com/summary.htm
GlowCode seemed to perform exactly what I wanted, so I registered a free evaluation key here :
http://www.glowcode.com/eval.htm
Then I downloaded it there :
http://www.glowcode.com/download/gcSetup.exe
I installed GlowCode 5.1, then registered it with the evaluation key I just received 5 minutes after my application. I started with the tutorial which prooved me I needed this tool so badly
End of story...
Nahhhhh, pulling your leg. Well, I read the help documentation, I found out how to 'preload' a DLL, hook its functions, then attach the whole things to the current process and profile the whole stuff. Basicaly, here are the steps to configure then perform the profiling :
- Put debug informations into your 'TurboDemo' and 'TurboDll' Release build
* Open each project
* Menu Project\Settings (Alt+F7)
* Select the Release mode !!!
* Select the C/C++ tab
* Check 'Generate browse info'
* Select 'Debug info:' to 'Program Database'
* Select the Link tab
* Check 'Generate debug info'
* Check 'Link incrementally'
But now, just download the new version and extract it somewhere :
http://david.koch.9online.fr/TreeListCtrlTigerX_modded.zip (1322 KiB)
NOTE : this version don't create 1440 items anymore (20*6*12), but 144000 instead (200*60*12). Longer loops helps the code profiler to show better where the program is stuck !
Once it is done, you should have all project files set up and all binary files ready for a code profiling. Just run GlowCode and follow the steps :
- Start gcLoader
- Select the release\TurboDemo.exe program
The TurboDemo program will starts before the gcLoader if completely opened, but we don't care right now. Here are the following steps to configure GlowCode to load the TurboDLL file :
- Menu Hooks\Preload...
- Browse for the Release DLL file (must be already in the right folder)
- Menu Hooks\Define...
- Add a new hook, click on 'Add'
- In 'Module', search the 'TurboDLL.dll' file (this is the Release file)
- Click OK, the output should show you something like :
TurboDemo.exe matches *.exe
38 functions hooked, 0 lines hooked
TurboDLL.dll matches TurboDLL.dll
411 functions hooked, 0 lines hooked
449 total functions hooked, 0 total lines hooked
- Click OK
GlowCode is now almost ready to perform a successfull profiling, we just have to select some few options :
- Select the Report tab
- Click the big Options button
- At the bottom right of the dialog box, check the three boxes (Report / Profile / Trace)
- Click OK
Now we can go, in few seconds, but first start the profiling :
- Push the big Run button
Now select the TurboDemo program waiting in the background, and click the 'Recreate tree' button, and observe what is going on in the GlowCode window... As you may have seen, the 'Total visit time' as run the pretty same amount of time shown in the bottom of the TurboDemo dialog box (delete + insert + expand time). In the GlowCode window, open the 'Modules' line, then the 'TurboDLL.dll' line. Sort the 'Total visit time' and see what function took the longest time to perfom...
In the archive, I put some screenshots of my profiling session, let me explain the steps of my analysis :
- Profile01.png : This shows the DEBUG build, which perfom quite well for the insertion of 144000 items.
- Profile02.png : This is the RELEASE build, and you can see it took more than 34 seconds to perfom. The program was stuck almost 21 seconds in the CTreeListItem constructor, and 8 seconds in the InsertItemNext function. That's where we should have a look !
To check which call was taking so much time in the InsertItemNext function, I just created a little dummy function in which I moved the 'new' operator, so that the code profiler may hang on it if it was its fault !
- Profile03.png : This snap shows that the program spend all the previous InsertItemNext time into the dummy CreateNewItem function. That's it, it's the 'new' operator which slow down everything. Now check what's inside the CTreeListItem constructor !
-Profile04.png : To be sure, in the Report tab, I made a right click on the faulty CTreeListItem constructor line, then clicked 'Goto First similar item in Profiler'. It opened the Profile tab, and located me where it was stuck. Nothe the toal amount of time spent in the CTreeListItem constructor from the dummy CreateNewItem function !
So I opened the TurboDLL project into Visual, located the CTreeListItem constructor inside TreeListItem.cpp :
CTreeListItem::CTreeListItem( int nSubItem ) :
m_pParent( NULL ),
m_pChild( NULL ),
m_pPrev( NULL ),
m_pNext( NULL ),
m_dwState( TLIS_SHOWCHECKBOX | TLIS_SHOWLOCKBOX | TLIS_CHECKED_NULL | TLIS_LOCKED_NULL ),
m_dwData( 0 ),
m_nLevel( 0 ),
m_nChild( 1 ),
m_nVisibleChild( 1 )
{
for( int iSubItem = 0; iSubItem < nSubItem; iSubItem++ )
{
CString* pSubItem = new CString;
m_arSubItems.Add( pSubItem );
}
}
It looked strange to me, so I took a look at the destructor just below :
CTreeListItem::~CTreeListItem()
{
while( m_arSubItems.GetSize() > 0 )
{
CString* pSubItem;
pSubItem = (CString*)m_arSubItems[m_arSubItems.GetUpperBound()];
m_arSubItems.RemoveAt( m_arSubItems.GetUpperBound() );
delete pSubItem;
}
}
It was pretty weird, but strictly logical in a point of view of code. Then how the hell the release build was wasting so much time in a so trivial function ? So I changed things a 'little'. In the header file, I changed the 'CPtrArray' member for a 'CStringArray' one, and changed the constructor and the destructor for the following code :
CTreeListItem::CTreeListItem( int nSubItem ) :
m_pParent( NULL ),
m_pChild( NULL ),
m_pPrev( NULL ),
m_pNext( NULL ),
m_dwState( TLIS_SHOWCHECKBOX | TLIS_SHOWLOCKBOX | TLIS_CHECKED_NULL | TLIS_LOCKED_NULL ),
m_dwData( 0 ),
m_nLevel( 0 ),
m_nChild( 1 ),
m_nVisibleChild( 1 )
{
m_arSubItems.SetSize( nSubItem );
}
CTreeListItem::~CTreeListItem()
{
}
Obvious, isn't it ? There was also two more changes in the code to reflect the change from a CString* to a CString reference, and all compiled successfully ! Then I tested the result...
No mistake, no memory leaks. When opening the TurboDemo, all ran fine. I then clicked the 'Recreate tree', and instead to spend 21 seconds, it only asked 8 seconds to perform. I clicked a second time, and it asked less than a second. So the change was successful, but led in a drawback -> the CStringArray must cache its memory on the heap a first time before being efficient.
Anyway, the GlowCode code profiler allowed me to spot very fast where the problem was. So it works well on purpose too
Sadly the product costs 300$ per user, which can be quite a show stopper for many of us. The interface is also quite confusing, with many 640x480 screen compliant dialog boxes hardly readable. The 'logic' of the UI is also quite a problem (many sub dialog boxes to open and configure before getting things to work). I would have loved a Drag'n Drop approach...
Beside these points, I finally got the TigerX's component to work well So have a nice day !
Kochise
PS : Note that the auto-blocking refresh system works by blocking any refresh as long as a process is currently making some changes in the component. When no more changes are performed for 40 ms, the component automatically refresh itself. So you don't have to care anymore with 'Refresh' of 'SetRedraw stuff Just do your work, the component will block itself as long as you have something to do inside...
Also note that I made all changes between my 'famous' MODIF_KOCH tags, and left the previous code in comment, so that you can track back my modifications. I would be glad you post your changes here as a follow-up, so that we won't have to surf the web to find updates !
In Code we trust !
|
|
|
|
|
... but I can´t link successfully.
Seems that none of the Symbols of CTreeListItem are exported by your project.
Any ideas ?
Thank you,
yoko
|
|
|
|
|
No idea, I not changed things much from the original project. Will get a look at it some days, thanks for pointing me out this issue !
Kochise
In Code we trust !
|
|
|
|
|
Missing AFX_EXT_CLASS prefix for class CTreeListItem prefented
the symbol from beeing exported:
Just change
class CTreeListItem
to
class AFX_EXT_CLASS CtreeListItem
in
TreeListItem.h
yoko
|
|
|
|
|
Kochise wrote: http://david.koch.9online.fr/TreeListCtrlTigerX_modded.zip
Good stuff, thanks.
|
|
|
|
|
good work!
I do similar operations, resetting the tree a few times and was scratching my head with memory leaks.
|
|
|
|
|