Sign in to follow this  
Followers 0
Clark

Treeview and vertical scrollbars

3 posts in this topic

Hi all

I've developed this little app which the organisation has been using for a bit now. It looks like this:

Posted Image

Now the problem is that the folders should really appear as a heirarchical structure. I have found some code to do this on the forums which uses treeview with the checkbox parameter set. It seems to work really well, however...

There is always a however.

As you can see from the attached image, the number of folders (these are retrieved from a database) can and does vary over time. Also, the number of folders is always likely to be more than what can be shown at any one time in the listview that it currently has.

So my question is (you knew I would get to the question eventually): How on earth do I include a vertical scrollbar so that the treeview can be scrolled up and down? (I've searched but cannot find the answer.)

TIA

Clark

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Do you mean something like this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <TreeViewConstants.au3>
$Requ = GUICreate("Requirements", 515, 337, -1, -1, $WS_CAPTION + $WS_SYSMENU, -1)
$hTreeView = GUICtrlCreateTreeView(16, 35, 233, 200, BitOR( $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_CHECKBOXES))
GUICtrlCreateTreeViewItem("Head 1", $hTreeView)
GUICtrlCreateTreeViewItem("Sub 1", -1)
GUICtrlCreateTreeViewItem("Sub 2", -1)
GUICtrlCreateTreeViewItem("Sub 3", -1)
GUICtrlCreateTreeViewItem("Sub 4", -1)
GUICtrlCreateTreeViewItem("Sub 5", -1)
GUICtrlCreateTreeViewItem("Head 2", $hTreeView)
GUICtrlCreateTreeViewItem("Sub 1", -1)
GUICtrlCreateTreeViewItem("Sub 2", -1)
GUICtrlCreateTreeViewItem("Sub 3", -1)
GUICtrlCreateTreeViewItem("Sub 4", -1)
GUICtrlCreateTreeViewItem("Sub 5", -1)
GUICtrlCreateTreeViewItem("Head 3", $hTreeView)
GUICtrlCreateTreeViewItem("Sub 1", -1)
GUICtrlCreateTreeViewItem("Sub 2", -1)
GUICtrlCreateTreeViewItem("Sub 3", -1)
GUICtrlCreateTreeViewItem("Sub 4", -1)
GUICtrlCreateTreeViewItem("Sub 5", -1)
GUICtrlCreateTreeViewItem("Head 4", $hTreeView)
GUICtrlCreateTreeViewItem("Sub 1", -1)
GUICtrlCreateTreeViewItem("Sub 2", -1)
GUICtrlCreateTreeViewItem("Sub 3", -1)
GUICtrlCreateTreeViewItem("Sub 4", -1)
GUICtrlCreateTreeViewItem("Sub 5", -1)
GUICtrlCreateTreeViewItem("Head 5", $hTreeView)
GUICtrlCreateTreeViewItem("Sub 1", -1)
GUICtrlCreateTreeViewItem("Sub 2", -1)
GUICtrlCreateTreeViewItem("Sub 3", -1)
GUICtrlCreateTreeViewItem("Sub 4", -1)
GUICtrlCreateTreeViewItem("Sub 5", -1)
GUICtrlCreateTreeViewItem("Head 6", $hTreeView)
GUICtrlCreateTreeViewItem("Sub 1", -1)
GUICtrlCreateTreeViewItem("Sub 2", -1)
GUICtrlCreateTreeViewItem("Sub 3", -1)
GUICtrlCreateTreeViewItem("Sub 4", -1)
GUICtrlCreateTreeViewItem("Sub 5", -1)
GUICtrlCreateTreeViewItem("Head 7", $hTreeView)
GUICtrlCreateTreeViewItem("Sub 1", -1)
GUICtrlCreateTreeViewItem("Sub 2", -1)
GUICtrlCreateTreeViewItem("Sub 3", -1)
GUICtrlCreateTreeViewItem("Sub 4", -1)
GUICtrlCreateTreeViewItem("Sub 5", -1)
GUISetState(@SW_SHOW) ; will display an empty dialog box
    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()
Edited by Aipion

Share this post


Link to post
Share on other sites

Perfect!

Thanks for your help.

:)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0