qwert Posted October 21, 2018 Share Posted October 21, 2018 (edited) From a post a couple of years ago: Quote GUICtrlCreateListViewItem places newly created ListViewItems right below the older ones. This is the result I want. But no matter which "add item" statement I use, the result always displays in descending (not ascending) order. ; ; Array and Listview Test ; #include <GuiListView.au3> #include <Array.au3> Local $aArray[4] $aArray[0] = "Jasper" $aArray[1] = "Beethoven" $aArray[2] = "Pinky" $aArray[3] = "Fidget" _ArrayDisplay($aArray) _ArraySort($aArray) _ArrayDisplay($aArray) GUICreate("Array and ListView Test", 300, 300) GUISetFont(12) $idListview = GUICtrlCreateListView("", 20, 20, 250, 220, 50) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) For $i = 0 To UBound($aArray) - 1 Step 1 MsgBox(0, "Next", $aArray[$i]) GUICtrlCreateListViewItem($aArray[$i], $idListview) Next GUISetState(@SW_SHOW) While 1 Switch GUIGetMSG() Case -3 ; $GUI_EVENT_CLOSE GUIDelete() Exit EndSwitch WEnd Thanks in advance for any help. Edited October 28, 2018 by qwert Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 21, 2018 Moderators Share Posted October 21, 2018 qwert, Your parameters for the GUICtrlCreateListView call are wrong - you are setting a style of 50 which is probably the cause of the problem. This works for me: #include <GuiListView.au3> #include <Array.au3> Local $aArray[4] $aArray[0] = "Jasper" $aArray[1] = "Beethoven" $aArray[2] = "Pinky" $aArray[3] = "Fidget" _ArrayDisplay($aArray) _ArraySort($aArray) _ArrayDisplay($aArray) GUICreate("Array and ListView Test", 300, 300) GUISetFont(12) $idListview = GUICtrlCreateListView(" ", 20, 20, 250, 250) ; You need at least one pixel for a column... _GUICtrlListView_SetColumnWidth($idListview, 0, 230) ; ...which you can expand like this _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) For $i = 0 To UBound($aArray) - 1 Step 1 MsgBox(0, "Next", $aArray[$i]) GUICtrlCreateListViewItem($aArray[$i], $idListview) Next GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 ; $GUI_EVENT_CLOSE GUIDelete() Exit EndSwitch WEnd M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
qwert Posted October 21, 2018 Author Share Posted October 21, 2018 Melba23, thanks. Indeed, that resolves the order. I don't rightly know where I got the 50 from ... but I seem to remember it had something to do with "no header". Do proper Listviews always have headers? This (but not inverted) is the result I'm after: Link to comment Share on other sites More sharing options...
qwert Posted October 21, 2018 Author Share Posted October 21, 2018 Well, it looks like $LVS_NOCOLUMNHEADER gives the result I'm after. I had never investigated List View versus Report View (which the documentation indicates is the default). Thanks for helping out with this. 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