cyanidemonkey Posted July 12, 2007 Share Posted July 12, 2007 I would like to stop the horizontal scroll bar showing when I load items into the ListView.I've found _GUICtrlListSetHorizontalExtent in GUIList.au3, but it refers to using $WS_HSCROLL style which I can not find a reference to in the Help file.I've also looked at the _GUICtrlListViewScroll in GuiListView.au3, but can't get it to stop the horizontal scroll.I've set the column widths and tried making the total less than the width of the ListView minus vertical scroll bar, but it still shows the horizontal scroll bar when the items load.Is it possible to stop horizontal scroll and retain vertical scroll?Related includes in my script:#include <GUIList.au3>#include <GUIConstants.au3>#include <GuiListView.au3>Do I need to include ListViewConstants.au3 also?Relative code:$listPL = GuiCtrlCreateListView("#|Track|Artist|Album|Lenght|Bitrate|Genre", 37, 20, 720, 160) _GUICtrlListViewSetColumnWidth($listPL,0,20) _GUICtrlListViewSetColumnWidth($listPL,1,216) _GUICtrlListViewSetColumnWidth($listPL,2,164) _GUICtrlListViewSetColumnWidth($listPL,3,120) _GUICtrlListViewSetColumnWidth($listPL,4,50) _GUICtrlListViewSetColumnWidth($listPL,5,50) _GUICtrlListViewSetColumnWidth($listPL,6,80) GUICtrlSetBkColor($listPL, 0x111199) GUICtrlSetColor($listPL, 0xffffff)Cheers. My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator Link to comment Share on other sites More sharing options...
smashly Posted July 12, 2007 Share Posted July 12, 2007 Try $listPL = GuiCtrlCreateListView("#|Track|Artist|Album|Lenght|Bitrate|Genre", 10, 60, 720, 160, $TVS_NOSCROLL) Cheers Link to comment Share on other sites More sharing options...
cyanidemonkey Posted July 12, 2007 Author Share Posted July 12, 2007 $TVS_NOSCROLL seems to kill the vertical scroll aswell. Is there a way to just stop Horizontal and retain Vertical scroll in ListView? My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator Link to comment Share on other sites More sharing options...
martin Posted July 12, 2007 Share Posted July 12, 2007 $TVS_NOSCROLL seems to kill the vertical scroll aswell. Is there a way to just stop Horizontal and retain Vertical scroll in ListView?Can you post some code which we can run and which shows the problem? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Zedna Posted July 12, 2007 Share Posted July 12, 2007 I tried $listPL = GuiCtrlCreateListView("#|Track|Artist|Album|Lenght|Bitrate|Genre", 10, 60, 720, 160, BitAND($GUI_SS_DEFAULT_LISTVIEW, BitNOT($WS_HSCROLL))) but it's not working Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
cyanidemonkey Posted July 12, 2007 Author Share Posted July 12, 2007 (edited) Can you post some code which we can run and which shows the problem? I've noticed that it only happen with XP style windows theme on. I use Classic windows theme style at home and it does not do the horizotal scroll, but if i try it on a computer at work with XP style windows theme, the horizontal scroll bar appears. Here's a chunk of related code (plus some other rubbish). Use dir to load a folder of mp3s. expandcollapse popupGlobal $VolOld=0 $duration=0 $old=0 Opt("WinTitleMatchMode" , 1) Opt("OnExitFunc" , "quit") Global $play=0 Dim $ar Global $lst = @ScriptDir & "\rr.lst" $sFilename="" Dim $title[100000],$Obj[100000] Dim $files[100000],$num[100000] #include <Array.au3> #include <GUIList.au3> #include <GUIConstants.au3> #include <WMMedia.au3> #include <multiple.au3> #include <GuiListView.au3> #include <file.au3> #Include <String.au3> $firsthit=0 Global $songs[100000][13] $oldpos=0 Global $fn=0 Global $listPL Opt("GUIOnEventMode", 1) $mp3list = GUICreate("mp3listview", 800, 300, 200, 100, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_GROUP,$WS_BORDER), BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_WINDOWEDGE,$WS_EX_ACCEPTFILES)) ;------------------------------------------------- PLAYLIST --------------------------------------------------; $groupPL = GUICtrlCreateGroup("Playlist", 30, 5, 735, 195) GUICtrlSetColor(-1 , 0xffffff) $listPL = GuiCtrlCreateListView("#|Track|Artist|Album|Lenght|Bitrate|Genre", 37, 20, 720, 160) _GUICtrlListViewSetColumnWidth($listPL,0,20) _GUICtrlListViewSetColumnWidth($listPL,1,216) _GUICtrlListViewSetColumnWidth($listPL,2,164) _GUICtrlListViewSetColumnWidth($listPL,3,120) _GUICtrlListViewSetColumnWidth($listPL,4,50) _GUICtrlListViewSetColumnWidth($listPL,5,50) _GUICtrlListViewSetColumnWidth($listPL,6,80) GUICtrlSetBkColor($listPL, 0x111199) GUICtrlSetColor($listPL, 0xffffff) #include"dclick.au3" $itemsPL = GUICtrlCreateLabel ("Item(s)", 702, 183, 55, 12,BitOR(0x1000,0x01)) GUICtrlSetFont (-1, 7) GUICtrlSetBkColor(-1,0xffffff) $dirPL = GUICtrlCreateButton ("dir", 305,180,30,15) GUICtrlSetTip (-1, "Add Folder(s)") GUICtrlSetFont (-1, 8) GUICtrlSetOnEvent ($dirPL, "DirPL") $delPL = GUICtrlCreateButton ("del", 398,180,30,15) GUICtrlSetTip (-1, "Remove track from Playlist") GUICtrlSetFont (-1, 8) GUICtrlSetOnEvent ($delPL, "DelPL") $clrPL = GUICtrlCreateButton ("clr", 429,180,30,15) GUICtrlSetTip (-1, "Clear Playlist") GUICtrlSetFont (-1, 8) GUICtrlSetOnEvent ($clrPL, "ClrPL") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents") $minx=0 $secx=0 onload() While 1 Sleep(1) WEnd Func DelPL() _GUICtrlListViewDeleteItemsSelected($listPL) count_items() EndFunc Func ClrPL() _GUICtrlListViewDeleteAllItems($listPL) count_items() EndFunc Func count_items() $c = _GUICtrlListViewGetItemCount($listPL) GUICtrlSetData($itemsPL, $c&" Items") EndFunc Func ImptPL() $fod = FileOpenDialog ("Add Playlist.", @ProgramFilesDir, "(*.pls;*.m3u;*.lst)") If @error = 1 Then Return ;MsgBox(0,"Info","$fod= "&$fod) _FileReadToArray ($fod, $ar) If StringInStr ($fod, ".pls", 2) Then ;WMP here (yet to be done) .wpl $str = StringAddCR (StringStripWS (StringRegExpReplace (StringRegExpReplace (StringRegExpReplace ( _ArrayToString ($ar, @LF, 3), "((?i)(?:Title)[0-9]{1,4})(?:=).{1,}", ""), "((?i)(?:Length)[0-9]{1,4})(?:=).{1,}", ""), "((?i)(?:File)[0-9]{1,4})(?:=)", ""), 4)) ; NEEDS EDITING TO IMPORT PROPERLY ^^^^^ MsgBox(0,"Info","$str= "&$str) ElseIf StringInStr ($fod, ".m3u", 2) Then $str = StringAddCR (StringStripWS (StringRegExpReplace (_ArrayToString ($ar, @LF, 3), "((?i)(?:#EXTINF)).{1,}", ""), 4)) ElseIf StringInStr ($fod, ".lst", 2) Then $str = _ArrayToString ($ar, @LF, 3) EndIf $str = "C:" & StringRegExpReplace($str, @LF, "|") $str = StringReplace($str, "|\", "|C:\") $str = StringTrimRight($str, 1) openfile($str) EndFunc Func OpenfilePL() Local $fileList = "", $fnx=0 $sFilename = FileOpenDialog("Select a file to use.", "", "Mp3s(*.mp3)|Wave Sound Files(*.wav)", 7) If $sFilename="" Then Return Else $loc=StringSplit($sFilename,"|") If $loc[0]<>1 Then For $i=2 To $loc[0] $files[$fnx]= $loc[1]&"\"&$loc[$i] $fnx+=1 Next Else $files[$fnx]= $loc[1] $fnx+=1 EndIf $fileList = _ArrayToString($files, "|",0,$fnx-1) openfile($fileList) EndIf EndFunc Func DirPL() $AudF = _SubDirFileListToArray("*.wav;*.mp3","Add Folder(s)") If $AudF[0] = 0 Then MsgBox(0,"Info","No Audio files here!") EndIf If IsArray($AudF) Then For $i = 1 To $AudF[0] openfile($AudF[$i]) Next EndIf EndFunc Func _SubDirFileListToArray($filter = "*.*",$dtext = "",$rootdir = "",$flag = "",$initialdir ="");=== now supports multiple filters "*.xyz;*.abc" Dim $list[1]=[0] $fsf = FileSelectFolder ($dtext,$rootdir,$flag,$initialdir) If @error = 1 Then Return $sFilter = StringSplit($filter,";") If @error = 1 Then $sFilter[0]= 1 $sFilter[1]=$filter EndIf For $y = 1 To $sFilter[0] $fla1 = _FileListToArray ($fsf, $sFilter[$y], 1) If @error = 2 Then Return 0 If IsArray ($fla1) Then For $i = 1 To $fla1[0] _ArrayAdd ($list, $fsf&"\"&$fla1[$i]) Next EndIf $DLTA = _DirListToArray($fsf) If IsArray ($DLTA) Then For $i = 1 To $DLTA[0] $fla = _FileListToArray ($DLTA[$i],$sFilter[$y], 1) If IsArray ($fla) Then For $x = 1 To $fla[0] _ArrayAdd ($list, $DLTA[$i]&"\"&$fla[$x]) Next EndIf Next EndIf Next $list [0] = UBound ($list) - 1 Return $list EndFunc Func _DirListToArray($sPath);======= By: MsCreatoR Local $i, $j, $rlist[1]=[0], $blist, $alist=_FileListToArray ($sPath, '*', 2) If IsArray ($alist) Then For $i=1 To $alist [0] _ArrayAdd ($rlist, $sPath & "\" & $alist [$i]) $blist = _DirListToArray ($sPath & "\" & $alist [$i]) If $blist[0]>0 Then For $j=1 To $blist [0] _ArrayAdd ($rlist, $blist [$j]) Next EndIf Next EndIf $rlist [0] = UBound ($rlist) - 1 Return $rlist EndFunc Func openfile($file) $loc=StringSplit($file,"|") If $loc[0]<>1 Then For $i=1 To $loc[0] $files[$fn]=$loc[$i] $Obj[$fn] = WMOpenFile($files[$fn]) $fn+=1 addlistitem() Next Return Else $Obj[$fn] = WMOpenFile($loc[1]) $files[$fn]=$loc[1] $fn+=1 addlistitem() EndIf EndFunc Func addlistitem() If $fn>0 Then $aux=Round(WMGetDuration($Obj[$fn-1])) $min=($aux-Mod($aux,60))/60 $sec=$aux-$min*60 GuiCtrlCreateListViewItem($fn&"|"&WmGetTitle($Obj[$fn-1])&"|"&WmGetArtist($Obj[$fn-1])&"|"&WmGetAlbum($Obj[$fn-1])&"|"& _ $min&":"&$sec&"|"&Round(WmGetBitrate($Obj[$fn-1])/1000)&"|"&WMGetGenre($Obj[$fn-1]), $listPL) count_items() EndIf EndFunc Func delete() If GUICtrlRead($listPL)<>"" Then $i=_GUICtrlListSelectedIndex($listPL) _ArrayDelete($num ,$i) _ArrayDelete($files , $i) _ArrayDelete($Obj, $i) _GUICtrlListDeleteItem($listPL , $i) $fn-=1 EndIf EndFunc Func quit() WMClosePlayer() Exit EndFunc Func onload() WMStartPlayer() EndFunc Func dclick() PlayA() EndFunc Func drop() For $i = 0 To UBound($gaDropFiles) - 1 openfile($gaDropFiles[$i]) Next EndFunc Func SpecialEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE Exit 0 Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE Case @GUI_CtrlId = $GUI_EVENT_RESTORE EndSelect EndFunc Edited July 12, 2007 by cyanidemonkey My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator Link to comment Share on other sites More sharing options...
Spogie Posted November 22, 2007 Share Posted November 22, 2007 Ok, I want the same answer.... I have created a program, that is working great (love autoIt)... But my GUICtrlCreateListView insists on scrolling to the right rather than the down I want. i have stripped the code to barebones as an example of the effect (using XP Pro SP2) expandcollapse popup;~ #AutoIt3Wrapper_run_debug_mode=Y ;~ #NoTrayIcon #include <GuiConstants.au3> #include <string.au3> #Include <GuiListView.au3> #include <File.au3> AutoItSetOption("MouseCoordMode", 0) AutoItSetOption("RunErrorsFatal", 0) AutoItSetOption("SendKeyDelay", 1) HotKeySet("^=", "populate") ; use ctrl= to refresh the list $gui = GUICreate("gui name", 480, 480) GUISetBkColor(0xFFFFFF) GUICtrlCreateLabel("Title", 10, 5, 460, 20) GUICtrlSetFont(-1, 12, 800, 2, "Comic Sans MS") $installprogs = GUICtrlCreateListView("Loading...", 10, 31, 225, 400, BitOR(0x4096, $LVS_SHOWSELALWAYS)) GUICtrlSetFont(-1, 12, 800, 2, "Comic Sans MS") GUICtrlSetLimit(-1, 225) ; to limit horizontal scrolling not working $go = GUICtrlCreateButton("Launch", 190, 440, 100, 30) GUICtrlCreateGroup("Description", 245, 200, 225, 225) GUISetState() Global $progs loadini() checkinstall() populate() SplashOff() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $GUI_EVENT_MINIMIZE Case $msg = $go go() EndSelect WEnd Exit Func loadini() $progs = IniReadSectionNames("programs.ini") Global $progsDir[UBound($progs) ], $progsInstalled[UBound($progs) ], $installList[UBound($progs) ] Global $progsIcon[UBound($progs) ] For $i = 1 To $progs[0] $progsDir[$i] = IniRead("programs.ini", $progs[$i], "dir", "--error--") Next EndFunc ;==>loadini Func checkinstall() For $i = 1 To $progs[0] $progsInstalled[$i] = FileExists($progsDir[$i]) Next EndFunc ;==>checkinstall Func populate() _GUICtrlListViewDeleteAllItems($installprogs) For $i = 1 To $progs[0] If $progsInstalled[$i] = 1 Then $installList[$i] = GUICtrlCreateListViewItem($progs[$i], $installprogs) GUICtrlSetImage($installList[$i], $progsIcon[$i]) Else $installList[$i] = GUICtrlCreateListViewItem($progs[$i], $installprogs) EndIf Next EndFunc ;==>populate Func go() EndFunc ;==>go and the .ini file that it needs (save as program.ini) expandcollapse popup[Program01] [Program02] [Program03] [Program04] [Program05] [Program06] [Program07] [Program08] [Program09] [Program10] [Program11] [Program12] [Program13] [Program14] [Program15] [Program16] [Program17] [Program18] [Program19] [Program20] [Program21] [Program22] [Program23] [Program24] [Program25] [Program26] [Program27] [Program28] [Program29] [Program30] [Program31] [Program32] [Program33] [Program34] [Program35] [Program36] [Program37] [Program38] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now