CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2004
    Location
    Pakistan
    Posts
    466

    Question Change listview style at runtime

    LVS_NOCOLUMNHEADER is a style for listview control which forces header to hide.

    Now, if I did not use it while creating the control, what is the way to add this style to listview control?

    I tested it cannot be set using ListView_SetExtendedListViewStyle, since it is not extended style.


    waiting for kind reply.
    » Please 'Rate This Post' if it helped (encourage us to help you more)
    » Build GUI in minute using rad c++
    » Free IDE + GUI code generator - screenshot
    » Free WINAPI sourcecode and tutorials

  2. #2
    Join Date
    Sep 2004
    Location
    Italy
    Posts
    389

    Re: Change listview style at runtime

    Did you try
    Code:
    SetWindowLong(listView, GWL_STYLE, GetWindowLong(listView, GWL_STYLE) | LVS_NOCOLUMNHEADER);

  3. #3
    Join Date
    Nov 2004
    Location
    Pakistan
    Posts
    466

    Re: Change listview style at runtime

    Thanks, it means LVS_????? styles can directly be added and removed at runtime.
    I was under impression that these might not work by simply adding to or removing from style.


    thanks kkez

    regards
    » Please 'Rate This Post' if it helped (encourage us to help you more)
    » Build GUI in minute using rad c++
    » Free IDE + GUI code generator - screenshot
    » Free WINAPI sourcecode and tutorials

  4. #4
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: Change listview style at runtime

    Extended styles , by Microsoft naming convention, have the _EX_ in them, for e.g. LVS_EX_CHECKBOXES. These are the styles for which you would use the Extended macros.

    As for which styles can be changed at runtime, it is best to refer to Microsoft documentation of the control. If there are certain styles that cannot be changed after creating the control, the documentation will indicate so at the top like
    Quote Originally Posted by msdn
    After the control has been created, these styles cannot be modified, except as noted.
    e.g. here, for ES_LOWERCASE , the documentation explicitly says it can be changed.

    For listview control styles, I don't see such statements, so I am guessing, one is allowed to change the styles at runtime.
    https://msdn2.microsoft.com/en-us/library/ms670561.aspx

  5. #5
    Join Date
    Nov 2004
    Location
    Pakistan
    Posts
    466

    Re: Change listview style at runtime

    Was successful.

    Thanks alot for the references.

    regards
    » Please 'Rate This Post' if it helped (encourage us to help you more)
    » Build GUI in minute using rad c++
    » Free IDE + GUI code generator - screenshot
    » Free WINAPI sourcecode and tutorials

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured