Results 1 to 6 of 6

Thread: [RESOLVED] Problem with Listview EnsureVisible

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,834

    Resolved [RESOLVED] Problem with Listview EnsureVisible

    Hi, I have a Listview that contains files (their full paths) and I'm uploading them to a server. When I start uploading a file or it has finished, I'm changing the first SubItem and the SmallIcon of that row.

    I'd like to make the Listview autoscroll to the file/row that is currently uploading, but every time the SmallIcon is changed the Listview refreshes, scrolls to the top and EnsureVisible is ignored.

    I'm using the Listview from Common Controls 5.0.

    vb Code:
    1. lvw.ListItems(HoldListIndex(lIndex)).SubItems(1) = "200 - OK!"
    2. lvw.ListItems(HoldListIndex(lIndex)).SmallIcon = 4 'moves scrollbar to top
    3. lvw.ListItems(HoldListIndex(lIndex)).EnsureVisible 'seems to be ignored/bypassed
    4. GetNextFile Index

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: Problem with Listview EnsureVisible

    What if you reverse the order and make ensurevisible the first call?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,834

    Re: Problem with Listview EnsureVisible

    Unfortunately that doesn't work. The Listview automatically scrolls back to the top every time something is changed in the Listview.

  4. #4
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Problem with Listview EnsureVisible

    Before Ensure Visible line, what about a
    Code:
    .Selected = True
    to the raw ?

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: Problem with Listview EnsureVisible

    Do you have sorting on or making a call to sort?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,834

    Re: Problem with Listview EnsureVisible

    The solution seems to be using ".Selected = True" like Fazi posted above or giving the Listview focus. ".EnsureVisible" works fine then.

    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