Jump to content

listview only scrolling horizontally

Recommended Posts

Hello all.  Consider the below code

#include <ListViewConstants.au3>
; *** End added by AutoIt3Wrapper ***
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; *** Start added by AutoIt3Wrapper ***
#include <FileConstants.au3>
; *** End added by AutoIt3Wrapper ***
; *** Start added by AutoIt3Wrapper ***
#include <ListBoxConstants.au3>
#include <MsgBoxConstants.au3>
; *** End added by AutoIt3Wrapper ***
#cs ----------------------------------------------------------------------------

    AutoIt Version: (Beta)
    Author:         myName

    Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiComboBox.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <Misc.au3>
#include <File.au3>
#include <GuiListView.au3>
#include <GUICtrlOnHover.au3>
;#include <GUICtrlOnHover.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
$MenuItem1 = GUICtrlCreateMenu("Add")
$MenuItem2 = GUICtrlCreateMenuItem("Folder", $MenuItem1)
$Label1 = GUICtrlCreateLabel("Pick your poison", 176, 16, 147, 29)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$dumm = GUICtrlCreateDummy()
$Combo1 = GUICtrlCreateCombo("", 40, 56, 409, 25, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE, $CBS_SORT, $WS_HSCROLL))
GUICtrlSetTip(-1, "Select the path you wish to view....")
$list1 = GUICtrlCreateListView ( "", 24, 96, 449, 422, BitOR($LVS_LIST,$LVS_NOCOLUMNHEADER,$LVS_SHOWSELALWAYS,$WS_VSCROLL))
$array2 = IniReadSection(@ScriptDir & "\settings.ini", "settings")
    Local $store2[$array2[0][0]]
    $here2 = 0
    For $i = 1 To $array2[0][0] Step 1
        GUICtrlSetData($Combo1, $array2[$i][1])
        ;   $here2 += 1
    ;GUICtrlSetData ( $Combo1, $store2 )
while 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $MenuItem2

        Case $Combo1
            _GUICtrlListView_DeleteAllItems ($list1)
            $use = GUICtrlRead($Combo1)
            If Not FileExists($use) Then
                #Region --- CodeWizard generated code Start ---

                ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=None, Miscellaneous=Top-most attribute
                MsgBox($MB_OK + 262144, "invalid path", "the path you selected does not exist or is inaccessible on local device/using current user.")
                #EndRegion --- CodeWizard generated code Start ---

                GUICtrlSetState($Button1, 128)
                $thelist = _FileListToArrayRec($use, "*", $FLTAR_FILESFOLDERS, Default, $FLTAR_SORT, Default)
                If GUICtrlRead($Checkbox1) = 1 Then
                    For $i = 1 To $thelist[0] Step 1
                        If IsFile($use & "\" & $thelist[$i]) = 0 Then
                            ;GUICtrlSetData($List1, $thelist[$i])
                            ;Assign ( "Listitem" & $i, GUICtrlCreateListViewItem ( $thelist[$i], $list1 ), 2 )
                            _GUICtrlListView_AddItem ( $list1, $thelist[$i], $i - 1 )
                            If StringRight($thelist[$i], 3) <> "pdf" And StringRight($thelist[$i], 3) <> "doc" Then
                                ;GUICtrlSetData($List1, $thelist[$i])
                                ;Assign ( "Listitem" & $i, GUICtrlCreateListViewItem ( $thelist[$i], $list1 ), 2 )
                                _GUICtrlListView_AddItem ( $list1, $thelist[$i], $i - 1 )
                    For $i = 1 To $thelist[0] Step 1
                        If IsFile($use & "\" & $thelist[$i]) = 0 Then
                            GUICtrlSetData($List1, $thelist[$i])
                            If StringRight($thelist[$i], 3) <> "pdf" And StringRight($thelist[$i], 3) <> "doc" And StringRight($thelist[$i], 3) <> "zip" Then
                                GUICtrlSetData($List1, $thelist[$i])
Func IsFile($sFilePath)
    Return Number(FileExists($sFilePath) And StringInStr(FileGetAttrib($sFilePath), "D", 2, 1) = 0)
EndFunc   ;==>IsFile

Whenever I try to populate many items into the list view, the list view seems to only scroll horizontally, when I want it to scroll vertically.  How can I accomplish this?

Link to post
Share on other sites

First off, your script won't run as is, there are undeclared variables in there.

Second, $WS_VSCROLL is a window style variable, and not a listview style.

Third, what do you mean when you say you want it to scroll vertically?  Listviews only have scroll bars as the lines/columns get too wide.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to post
Share on other sites
  • 2 weeks later...

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...