CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 1999
    Posts
    2

    ListView Selection & Permanent Highlights

    What is LVS_SHOWSELALWAYS supposed to do?
    I want to keep the currently selected item always highlighted in the ListView
    When deleting an item, eg. click on it, then delete the selected item:
    ie. lvwTest.ListItems.Remove lvwTest.SelectedItem.Index, the selected item is deleted, and the currently selected index will be set
    automatically but not highlighted.
    Is there also a way to keep the currently selected item highlighted when focus is off the listview? Setting HideSelection = False keeps the
    item as grey (as opposed to blue) with std colours, when focus is off, but the original problem still applies.
    Is there a really good book for VB/Win32 that helps with such things? I am also looking for a book that deals with passing arrays and structures
    containing arrays and string arrays from VB > C and C > VB.
    Thanks in advance for any replies....


  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: ListView Selection & Permanent Highlights

    Hi

    >What is LVS_SHOWSELALWAYS supposed to do?
    >I want to keep the currently selected item always highlighted in the ListView

    The LVS_SHOWSELALWAYS flag is the same as setting the '.HideSelection' property of the VB5/6 ListView.

    >When deleting an item, eg. click on it, then delete the selected item:
    >ie. lvwTest.ListItems.Remove lvwTest.SelectedItem.Index, the selected
    >item is deleted, and the currently selected index will be set
    >automatically but not highlighted.

    Have you tried something like :


    ListView1.ListItems.Remove ListView1.SelectedItem.Index
    set ListView1.SelectedItem = ListView1.SelectedItem




    (with '.HideSelection' = false)

    I know that the second line seems a bit silly but it works fine here !


    >Is there a really good book for VB/Win32 that helps with such things? I
    >am also looking for a book that deals with passing arrays and structures
    >containing arrays and string arrays from VB > C and C > VB.
    >Thanks in advance for any replies....

    There's not really a good book for VB on programming/api stuff with the Common Controls - if you know C/C++ (or enough to convert it to VB) then you *definately* can't find a better site than the CodeGuru MFC site (the granddaddy of CodeGuru) - http://www.codeguru.com. You'll find 1000's of articles on all kinds of neat stuff, most of which can be converted to VB5/6.


    Regards

    Chris Eastwood

    CodeGuru - the website for developers
    http://www.codeguru.com/vb

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