Newb Posted January 24, 2011 Share Posted January 24, 2011 (edited) Hi all,This is what i getWith this code#include <GuiListBox.au3> $GuiPrincipale = GUICreate("New Gui", 802, 617, 156, 96) GUICtrlCreateGroup("Features", 16, 512, 273, 57) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Checkbox2 = GUICtrlCreateCheckbox("actions", 24, 536, 161, 17) $List = GUICtrlCreateList("", 184, 528, 97, 34) GUICtrlSetData(-1, "1-5 Seconds|1-10 Seconds|1-15 Seconds|1-20 Seconds|1-25 Seconds|1-30 Seconds") _GUICtrlListBox_SetItemData($List,0,5) _GUICtrlListBox_SetItemData($List,1,10) _GUICtrlListBox_SetItemData($List,2,15) _GUICtrlListBox_SetItemData($List,3,20) _GUICtrlListBox_SetItemData($List,4,25) _GUICtrlListBox_SetItemData($List,5,30) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndWhy the hell the first item is dropped bottom list? As u see the order is:GUICtrlSetData(-1, "1-5 Seconds|1-10 Seconds|1-15 Seconds|1-20 Seconds|1-25 Seconds|1-30 Seconds") Edited January 24, 2011 by Newb I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it. Link to comment Share on other sites More sharing options...
JohnOne Posted January 24, 2011 Share Posted January 24, 2011 looks alphanumeric to me. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Varian Posted January 24, 2011 Share Posted January 24, 2011 (edited) When you created your ListBox, you did not specify a style, so the defaults were used. The defaults for the listbox are:$LBS_SORT, $WS_BORDER, $WS_VSCROLL$LBS_SORT is sorting the list, and 1-5 is the last (highest) item when the list is sorted. You must do one of two things:Format your numbers so that the desired sort occursORYou should define your style (and add necessary includes) to remove $LBS_SORT:#include <GuiListBox.au3> #include <WindowsConstants.au3> $GuiPrincipale = GUICreate("New Gui", 802, 617, 156, 96) GUICtrlCreateGroup("Features", 16, 512, 273, 57) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Checkbox2 = GUICtrlCreateCheckbox("actions", 24, 536, 161, 17) $List = GUICtrlCreateList("", 184, 528, 97, 34, $WS_BORDER + $WS_VSCROLL) GUICtrlSetData(-1, "1-5 Seconds|1-10 Seconds|1-15 Seconds|1-20 Seconds|1-25 Seconds|1-30 Seconds") _GUICtrlListBox_SetItemData($List, 0, 5) _GUICtrlListBox_SetItemData($List, 1, 10) _GUICtrlListBox_SetItemData($List, 2, 15) _GUICtrlListBox_SetItemData($List, 3, 20) _GUICtrlListBox_SetItemData($List, 4, 25) _GUICtrlListBox_SetItemData($List, 5, 30) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited January 24, 2011 by Varian Link to comment Share on other sites More sharing options...
Newb Posted January 24, 2011 Author Share Posted January 24, 2011 (edited) When you created your ListBox, you did not specify a style, so the defaults were used. The defaults for the listbox are: $LBS_SORT, $WS_BORDER, $WS_VSCROLL $LBS_SORT is sorting the list, and 1-5 is the last (highest) item when the list is sorted. You must do one of two things: Format your numbers so that the desired sort occurs OR You should define your style (and add necessary includes) to remove $LBS_SORT: #include <GuiListBox.au3> #include <WindowsConstants.au3> $GuiPrincipale = GUICreate("New Gui", 802, 617, 156, 96) GUICtrlCreateGroup("Features", 16, 512, 273, 57) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Checkbox2 = GUICtrlCreateCheckbox("actions", 24, 536, 161, 17) $List = GUICtrlCreateList("", 184, 528, 97, 34, $WS_BORDER + $WS_VSCROLL) GUICtrlSetData(-1, "1-5 Seconds|1-10 Seconds|1-15 Seconds|1-20 Seconds|1-25 Seconds|1-30 Seconds") _GUICtrlListBox_SetItemData($List, 0, 5) _GUICtrlListBox_SetItemData($List, 1, 10) _GUICtrlListBox_SetItemData($List, 2, 15) _GUICtrlListBox_SetItemData($List, 3, 20) _GUICtrlListBox_SetItemData($List, 4, 25) _GUICtrlListBox_SetItemData($List, 5, 30) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd It works, but i really didn't get your explanation Gotta look in the help file deeply Thanks Edited January 24, 2011 by Newb I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it. Link to comment Share on other sites More sharing options...
Varian Posted January 24, 2011 Share Posted January 24, 2011 It works, but i really didn't get your explanation Gotta look in the help file deeplyThanksIt's pretty simple. When you created your ListBox, you went with the default style (since you did not specify any style). The default style is the same as adding $LBS_SORT + $WS_BORDER + $WS_VSCROLL in the style option.You did not want to use sort ($LBS_SORT), because the "1-5" would have been last in the list. If you had made it "1-05" it would have been first and you would have had your expected results.In order to do that, you must specify what styles to use, as though you were adding extra styles to the ListBox. In order to specify the styles manually, you must include whatever files that define those styles. In this case, I only used $WS_BORDER + $WS_VSCROLL which are both defined in WindowsConstants.au3You can also negate styles, but that is more complicated (in my opinion). 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