Results 1 to 7 of 7

Thread: Listview > scroll > manually

  1. #1

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Ok, a listbox scrolls whenever you change the listindex, but how do i do that with the listview, at least i would like to set the topindex manually
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    I normaly use the EnsureVisible method of the ListItem.

  3. #3

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Red face

    Damn, that simple, thanks anyway
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4
    Member
    Join Date
    May 2000
    Posts
    63
    EnsureVisible method does work - But in past experiences in using it, the selected item appears "somewhere" in the visible window of the listview. Is there a way to make a selected item appear at the first visible row of the listview?

  5. #5

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Hmm, the topindex you mean? Oh, i'm sure there must be a way, i've seen it somewhere, but this time ensurevisible is good enough for me
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    Member
    Join Date
    May 2000
    Posts
    63
    Yes - The topindex basically.

    In my application I have a textbox above the listview. Lets say the first listview column is "Last Name." In the keypress event of the textbox, I capture the contents of the textbox, then loop thru the listitems searching for the contents of the textbox. If I find it, I make that listitem the selecteditem, and ensure visibility on that item. Then I setfocus on the textbox and make sure the cursor is at the end of the text, waiting for the next key from the user. Basically the same functionality of IEs address bar. As you type the system tries to point you to the item you're looking for.

    Problem with ensure visible in my application is that the listview is pretty tall. As you type and the selected item changes, when you ensure visible the selected item isn't always in the same place. It'd be nice to always have the selected item at the top.

    I know this is somewhat picky, but we all know how end users can be at times.

    later...

  7. #7

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Try this, i'm not sure if it works with listview but it works with listbox...
    Code:
    Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Public Const LB_SETTOPINDEX = &H197
    
    SendMessage ListBox1.hWnd, LB_SETTOPINDEX, newItemIndex, 0
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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