dinodod Posted August 21, 2008 Posted August 21, 2008 I'm just wondering if there is a way to sort X number of rows in a GUICtrlCreateListView? I came across a sample script but it doesn't sort correctly and it's limited to 3 entries. I haven't came across any otehr samples and before I go about re-writing history, I'd thought I'd ask 1st. Thanks! Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007
PsaltyDS Posted August 21, 2008 Posted August 21, 2008 I'm just wondering if there is a way to sort X number of rows in a GUICtrlCreateListView? I came across a sample script but it doesn't sort correctly and it's limited to 3 entries. I haven't came across any otehr samples and before I go about re-writing history, I'd thought I'd ask 1st._GUICtrlListView_SimpleSort() Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
dinodod Posted August 22, 2008 Author Posted August 22, 2008 Thanks! The documentation in the UDF help file was very much overkill. I had to find some other examples to understand the function. Hey Autoit guys, take note of the UDF HELP file for this function. Can ya clean it up some? #include <GuiConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> Dim $Direction2[2] Dim $v_sort = False GUICreate("Test", 300, 200) GUISetBkColor(0x00E0FFFF) ; will change background color $lv = GUICtrlCreateListView("Column1|Col2|Col3", 10, 10, 280, 90,$LVS_NOLABELWRAP,Bitor($WS_EX_CLIENTEDGE, $LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES)) GUICtrlSendMsg($lv, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($lv, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlCreateListViewItem("line4|00005|more_a", $lv) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ;Or $msg = $Btn_Exit ExitLoop Case $msg = $lv F_HeaderSort2($lv, GUICtrlGetState($lv)) EndSelect WEnd GUIDelete() Exit ; ================================================ ; Functions ; ================================================ Func F_HeaderSort2(ByRef $lv, $column) msgbox(0,"",$column) If $Direction2[$column] = 'Ascending' Then $v_sort = False ;Dim $v_sort = _GUICtrlListView_GetColumnCount ($GUIList) Else $v_sort = True ;Dim $v_sort[_GUICtrlListView_GetColumnCount ($GUIList) ] EndIf If $Direction2[$column] = 'Ascending' Then $Direction2[$column] = 'Decending' Else $Direction2[$column] = 'Ascending' EndIf _GUICtrlListView_SimpleSort($lv, $v_sort, $column) EndFunc;==>_HeaderSort2 Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007
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