ragnarok775 Posted December 6, 2008 Share Posted December 6, 2008 (edited) Im working on a small script that makes *.m3u (playlist) files and I have a GUI that contains a Listbox. My problem is if a file has a very large directory (larger than the set size of the listbox), a scroll bar doesn't appear in the same way it would in the vertical direction. I looked through the styles and didn't see anything about a Horizontal scroll bar. This is what I have tried so far. $guictrl[1] = GUICtrlCreateList("", 60, 10, 630, 210, $LBS_SORT = 0 & $WS_HSCROLL = 1) I am not very familiar with using GUI styles so the line above is probably incorrect. While $i < $arraypos GUICtrlSetData($guictrl[1], $files[$i]) $strlen = StringLen($files[$i]) If $strlen > 88 Then $horiz_fit = Round($strlen * 7.08) EndIf $i += 1 WEnd _GUICtrlListBox_SetHorizontalExtent($guictrl[1], $horiz_fit) I could be using _GUICtrlListBox_SetHorizontalExtent() incorrectly I am not sure, but I know I am missing somthing. Any help is greatly appreciated. Edited December 6, 2008 by ragnarok775 Link to comment Share on other sites More sharing options...
Josbe Posted December 6, 2008 Share Posted December 6, 2008 ... This is what I have tried so far. $guictrl[1] = GUICtrlCreateList("", 60, 10, 630, 210, $LBS_SORT = 0 & $WS_HSCROLL = 1) ...Overwriting constants...No way. Try: $guictrl[1] = GUICtrlCreateList("", 60, 10, 630, 210, BitOr($LBS_SORT, $WS_HSCROLL)) AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
ragnarok775 Posted December 6, 2008 Author Share Posted December 6, 2008 I figured I was doing something wrong on that line, the problem now is $LB_SORT is turned on by default by putting $LB_SORT = 0 i was able to turn it off but that is probably not the correct way of doing so. So the reason $WS_HSCROLL wasn't working was because i messed up all the values by changing $LB_SORT to 0. How would I go about turning $LB_SORT off and $WS_HSCROLL on in the same line? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted December 6, 2008 Share Posted December 6, 2008 I figured I was doing something wrong on that line, the problem now is $LB_SORT is turned on by default by putting $LB_SORT = 0 i was able to turn it off but that is probably not the correct way of doing so. So the reason $WS_HSCROLL wasn't working was because i messed up all the values by changing $LB_SORT to 0. How would I go about turning $LB_SORT off and $WS_HSCROLL on in the same line? You don't turn something off, only the styles that is defined will be used so simply omit $LB_SORT $guictrl[1] = GUICtrlCreateList("", 60, 10, 630, 210, $WS_HSCROLL) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
ragnarok775 Posted December 6, 2008 Author Share Posted December 6, 2008 (edited) That is the problem, $LB_SORT (sorts everything in the list box by alphanumeric order) is on by default. I cannot make it properly display the items in the files[] array in the order that they are. Ex. Say I have the following array: $file[0] = "ZEBRA" $file[1] = "APPLE" $file[2] = "DOG" If I use $guictrl[1] = GUICtrlCreateList("", 60, 10, 630, 210, $WS_HSCROLL) When I load the array into the Listbox, it displays APPLE DOG ZEBRA But when I added in the $LB_SORT = 0 it showed the files in the same order as the array, which is what I want. EDIT: OK, after playing with GUICtrlSetStyle and other things... Completely out of the blue, the listbox stopped putting things in alphanumeric order. But anyway, the Listbox is working properly now. Thank You AdmiralAlkex & Josbe for taking the time to read my post and help out. Edited December 6, 2008 by ragnarok775 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted December 6, 2008 Share Posted December 6, 2008 You are wrong, they are not sorted at all #include <WindowsConstants.au3> GUICreate("test") $List = GUICtrlCreateList("", 0, 0, "", "", $WS_HSCROLL) GUISetState() GUICtrlSetData($List, "ZEBRA|APPLE|DOG") While 1 Sleep(10) WEnd .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
ragnarok775 Posted December 6, 2008 Author Share Posted December 6, 2008 (edited) You are wrong, they are not sorted at all #include <WindowsConstants.au3> GUICreate("test") $List = GUICtrlCreateList("", 0, 0, "", "", $WS_HSCROLL) GUISetState() GUICtrlSetData($List, "ZEBRA|APPLE|DOG") While 1 Sleep(10) WEnd Call me a liar if you wish but I know what I saw and it caused me problems with a couple of my functions for like an hour last night to the point where I just stopped trying and went to sleep. A bug maybe? I don't know, but all last night I could not figure out why when I called my Swap function, basically switched $files[$i] data with $files[$i + 1], and then used _ArrayDisplay[$files]... the Display showed that my function worked fine but the Listbox would always put them in a different order. EDIT: OK, I just found out what the problem was, and maybe I just don't know how Styles work but here is what happens If I use $guictrl[1] = GUICtrlCreateList("", 60, 10, 630, 210, $WS_HSCROLL) The listbox does not Sort itself in Alphanumric order.... BUT if you use $guictrl[1] = GUICtrlCreateList("", 60, 10, 630, 210) Which is what I was doing ALL last night (I didn't need the horizontal scroll bar yet). Then IT WILL SORT the values. Edited December 6, 2008 by ragnarok775 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted December 6, 2008 Share Posted December 6, 2008 When you don't define any style the default ones are used and $LBS_SORT happens to be one of the defaults. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
ragnarok775 Posted December 6, 2008 Author Share Posted December 6, 2008 I was not aware of that... Thank You for the help AdmiralAlkex. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted December 6, 2008 Share Posted December 6, 2008 Glad i could be of service .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface 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