CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2001
    Location
    Germany
    Posts
    1,384

    Disable TreeView auto scrolling...

    Hi *!
    I have a TreeView in my application. The problem I am having with TreeView is that if I expand one the ParentItem that contains "many" children, the TreeView automatically scrolls the ParentItem to the top so that maximum number of child items can be displayed in the TreeView client area. I don't want this behaviour. Is there any flag or something that can change this behaviour so that the TreeView never scrolls "automatically"??????
    Thanks for your time,
    Regards,
    Usman.

  2. #2
    Join Date
    Aug 2001
    Location
    Germany
    Posts
    1,384

    Re: Disable TreeView auto scrolling...

    Anyone????

  3. #3
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Disable TreeView auto scrolling...

    There is no such flag. You can see all the tree view styles at Tree-View Control Window Styles from MSDN.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  4. #4
    Join Date
    Aug 2001
    Location
    Germany
    Posts
    1,384

    Re: Disable TreeView auto scrolling...

    Yep I know those styles, I thought may be someone knows a trick that can turn this off . Thanks anyways.
    Regards,
    Usman.

  5. #5
    Join Date
    Aug 2013
    Posts
    1

    Re: Disable TreeView auto scrolling...

    I'm running into the same problem with C#/.NET. This is especially troublesome because if the user double-clicks to open a node tree, the double-click, after the node tree is expanded and brought to the top of the display, extends down to the item that is in the position where the old parent node was located.

  6. #6
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Disable TreeView auto scrolling...

    Sorry, don't know c#/.net. But one possible way of doing this in c/c++ using the standard windows API is to check for the TVN_ITEMEXPANDING notification and use TreeView_GetFirstVisible(..) to get the handle of the first visible item. Then for the TVN_ITEMEXPANDED notification, use TreeViev_EnsureVisible(..) with the handle obtained from the previous TreeView_GetFirstVisible.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

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