CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Still trying to highlight a ListCtrl

    I have a listctrl within my dialog box, yet have tried many times to highlight the first item in the list ( index 0 ).

    I place the functions in the OnInitdialog part of my code,yet still i have had no success.

    I have currently tried

    m_List.SetItemState( 0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);

    m_List.EnsureVisible( 0, FALSE);

    Someone please tell me what I am doing wrong.


  2. #2
    Join Date
    Sep 1999
    Posts
    33

    Re: Still trying to highlight a ListCtrl

    The first line you wrote is correct and sufficient... Did you use this function before the call to the parent OnInitiDialog ? You should perhaps also check the 'Show selection always' check box in the properties of the resource.


  3. #3
    Guest

    Re: Still trying to highlight a ListCtrl

    I have called the function within the OnInitDialog, just after all of the m_List.InsertItem calls.

    I have also checked the properties box, and the show always selection is ticked.

    However it still wont highlight. The text colour is black, and the background colour is light blue. If i click on one of the items in the list when running the program it highlights yellow. However it will not highlight the first item initially. Do you have any ideas ?

    Many 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
  •  





Click Here to Expand Forum to Full Width

Featured