#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    2
    Rep Power
    0

    Post 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???
  2. #2
  3. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    244
    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.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    2
    Rep Power
    0

    Cool 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

IMN logo majestic logo threadwatch logo seochat tools logo