October 10th, 2003, 05:17 AM
-
Some problem with CListCtrl on VC++ .NET
I have some problem with a CListCtrl in VC++ 7.0. I created a new project. And i try to change style of CListView. In code I wrote like this
void CStatView::OnInitialUpdate()
{
....
GetListCtrl().ModifyStyle(NULL, LVS_REPORT);
....
}
and no effects.
I try change style by that way. I run program and try to click button on toolbar which change style (big icon, small icon, list and detail). Also no effects.
What is the problem???
October 10th, 2003, 07:22 AM
-
I stay away from .Net and use VC6, but I expect under the hood it is all the same old crap anyway. I have had plenty of nightmares with MFC exactly like you are describing, so maybe I can offer places to look for problems. Without bothering to take the time to look up all your calls (I presume you are doing so), I would check to see if you are even grabbing a handle to the correct instance. I am pretty sure you have to pass the ID of an object in any effort to modify it, and it looks to me (again, without any research) that you are not doing so, just sending a new code to change the look and feel of some unknown object. I exect that many MFC calls will silently fail if you do something wrong (sort of like Perl in that regard, I also hate to work with Perl) like fail to send it an appropriate ID. Try to see what the handle looks like in some part of the code where you can be sure you have the handle, then see what you get when you try to change it in your code. MFC is its own language that just happens to have syntax like C++. Think of working with Java; it is so close to C++, yet so far away.
October 10th, 2003, 07:49 AM
-
Some problem with CListCtrl on VC++ .NET
I understood the reason of problem.
When I create project in MFC style there is no problem with CListCtrl. It create column and show item.
But when I create project in Explorer style like a window eplorer with left view (tree)
it problem. And i tried to change place of code. I wasn't put code in
void CStatView::OnInitialUpdate()
i just put it in function "item double click left view". No problem now.
Program show column and items
Thanks for help