CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2003
    Posts
    42

    Listview + focus

    Hi

    When i select a row in the listview, and i typ a value in a textbox on the form my focus is "lost" in the listview. However, if i do mylistview.selectedrow ... i still see that the row is selected ... how can i solve this little problem?

    Greetings,
    Jay

  2. #2
    Join Date
    Nov 2002
    Location
    Oakville, Ontario
    Posts
    48
    Hi there;

    I have been toiling with the beloved listview over the past 4 months in my project (I really dig this control) - Question: Is the problem this? - when the listview loses focus, is the selected row not visible? If not, try setting the FullRowSelect property to true in the properties window. This is how I got around it - and when the listview loses focus, the selected row appears gray, but still selected and visible to the user. Let me know if your scenario differs.

  3. #3
    Join Date
    Mar 2003
    Posts
    42
    Hi

    That property is already set on true.
    But i totally don't see the selection (not even gray).
    I know it "selects" the row but doesn't show it. Why? Because i have a field where i can type the number of articles. When i type the number in that field and i press add, the "selected" article is added. (but you don't see the selection)

    Greetings,
    Jay

  4. #4
    Join Date
    Nov 2002
    Location
    Oakville, Ontario
    Posts
    48
    Hmmm....not sure what is going on. If possible, please provide some code.

  5. #5
    Join Date
    Mar 2003
    Posts
    42
    Well, there isn't much of code.

    When the users clicks the button to add the article to his personal list of articles, then this code is executed:
    Call InsertArtikel(lstAlleArtikels.SelectedItem.Tag, txtAantal.Text)
    txtAantal.Text = ""
    Call FillPersonalList


    But this code is only executed when the users presses the button. If i type in a textbox certain text on the same form, the focus is already lost. So code posting has no influence here

    Is there anyway to leave the focus on that row in the listview?


    Greetings,
    Jay

  6. #6
    Join Date
    Nov 2002
    Location
    Oakville, Ontario
    Posts
    48
    Hi there;

    Well, I just ran my project and went to a spot where I also have a text box with a listview. I selected a row, then clicked on the textbox, and the row went from blue to gray. So I backtracked a bit (I set these listviews up a few months ago!) and rechecked some of the properties and remembered! I also had to set the property 'HideSelection' to false - could that be it!?

  7. #7
    Join Date
    Mar 2003
    Posts
    42
    Yes yes yes. This was the problem. Now it is indeed grayed. This is good enough. The user just didn't know which row was selected (now that it is grayed, he can know)

    Thanks ALOT!! Ahara for all the efforts (including making a new project)

    Lots of greetings,
    Jay

  8. #8
    Join Date
    Nov 2002
    Location
    Oakville, Ontario
    Posts
    48

    [RESOLVED]

    My pleasure! It was good for me to review! Cheers

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