List control-- Seperating rows
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12

Thread: List control-- Seperating rows

  1. #1
    Join Date
    Jul 2005
    Posts
    82

    List control-- Seperating rows

    hi frnds
    how can i seperate the rows in a list box or list control (using line)


    thanks in advance
    shemna

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    827

    Re: List control-- Seperating rows

    Add a line of minuses (i.e, "-------------") and give it a -1 or some other value that your list control won't use. The downside of this method is that user can still select it. In this case you'll need to show a warning or pop the list back up. You may also edit list box notifications LBN_SELCHANGE (NM_CLICK, LVN_ITEMCHANGING, LVN_ITEMCHANGED) to dismiss user selection of this separator. See MSDN for more details.

    Another way would be to create your own list control or buy someone elses.
    Last edited by dc_2000; August 24th, 2005 at 11:43 PM.

  3. #3
    Join Date
    Feb 2003
    Location
    Chennai
    Posts
    103

    Re: List control-- Seperating rows

    Hi,
    You can change list control style with LVS_EX_GRIDLINES.
    By setting this style
    "Displays gridlines around items and subitems. This style is available only in conjunction with the LVS_REPORT style."

    I hope this helps you.
    pops

  4. #4
    Join Date
    Jul 2005
    Posts
    82

    Re: List control-- Seperating rows

    Quote Originally Posted by Prabakaran
    Hi,
    You can change list control style with LVS_EX_GRIDLINES.
    By setting this style
    "Displays gridlines around items and subitems. This style is available only in conjunction with the LVS_REPORT style."

    I hope this helps you.

    did it
    but i am getting the error
    (296): error RC2104 : undefined keyword or key name: LVS_EX_GRIDLINES

  5. #5
    Join Date
    Feb 2003
    Location
    Chennai
    Posts
    103

    Re: List control-- Seperating rows

    Please include following header file "Commctrl.h" in your source file.

    #include <Commctrl.h>
    pops

  6. #6
    Join Date
    Jul 2004
    Posts
    142

    Re: List control-- Seperating rows

    from Commctrl.h:

    #define LVS_EX_GRIDLINES 0x00000001

    if you are using MFC, add to stdafx.h the line
    #include <afxcmn.h>

    and that should do it.

  7. #7
    Join Date
    May 1999
    Location
    DELAWARE, USA
    Posts
    9,915

    Re: List control-- Seperating rows

    How did you add LVS_EX_GRIDLINES style? In a resource editor?
    You should use SetExtendedStyle to set this style. IE must be ver 4 or higher and _WIN32_IE should be defined 0x0400 or higher.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  8. #8
    Join Date
    Jul 2004
    Posts
    142

    Re: List control-- Seperating rows

    Here are all the extended list view styles
    http://msdn.microsoft.com/library/de.../ex_styles.asp

  9. #9
    Join Date
    Apr 2013
    Posts
    77

    Re: List control-- Seperating rows

    I added that header file also.But i am not getting.Actually i created the list control using resource editor.So i added that style to .rc file.But now also showing the same error.What to do?

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,392

    Re: List control-- Seperating rows

    From MSDN:
    LVS_EX_GRIDLINES
    Version 4.70. Displays gridlines around items and subitems. This style is available only in conjunction with the LVS_REPORT style.
    Besides:
    1. What header file did you add and where?
    2. How is _WIN32_IE defined in your project?
    3. How exactly did you set LVS_EX_GRIDLINES style (how did you add that style to .rc file?)
    Victor Nijegorodov

  11. #11
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,295

    Re: List control-- Seperating rows

    Quote Originally Posted by manjut19 View Post
    I added that header file also.But i am not getting.Actually i created the list control using resource editor.So i added that style to .rc file.But now also showing the same error.What to do?
    What version of Visual Studio are you using?

  12. #12
    Join Date
    Apr 2013
    Posts
    77

    Re: List control-- Seperating rows

    Quote Originally Posted by Arjay View Post
    What version of Visual Studio are you using?
    2008 ver.But igot the grid line.I used the function
    HTML Code:
    ListView_SetExtendedListViewStyle()
    Thanks..

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center