Search the Community
Showing results for tags 'numeric'.
-
Hi, just a short question. I 've got a lisitview with a few columns and I want to register a different sort for two kinds of columns. I 've got a solution, but I don't think it is a good one. Example : Col A = Names (Strings) Col B = Age (Integers) Right now I'm doing this: 1. _GUICtrlListView_RegisterSortCallBack 2. In my WM_NOTIFY Case GUICtrlGetHandle($search_LV) Switch $iCode Case $LVN_COLUMNCLICK ; A column was clicked Local $tInfo = DllStructCreate($tagNMLISTVIEW, $iLparam) ; Kick off the sort callback ;~ ConsoleWrite('SEARCH_LV Column geklickt' & @LF) ConsoleWrite("Sort: " & DllStructGetData($tInfo, 'SubItem')) If $ColumnSorted <> DllStructGetData($tInfo, 'SubItem') Then _GUICtrlListView_UnRegisterSortCallBack($search_LV) ConsoleWrite('NEU' & @CRLF) EndIf $ColumnSorted = DllStructGetData($tInfo, 'SubItem') If DllStructGetData($tInfo, 'SubItem') = 9 Or DllStructGetData($tInfo, 'SubItem') = 10 Then ConsoleWrite('True: ' & _GUICtrlListView_RegisterSortCallBack($search_LV, True) & @CRLF) Else ConsoleWrite('False ' & _GUICtrlListView_RegisterSortCallBack($search_LV, False) & @CRLF) EndIf _GUICtrlListView_SortItems($search_LV, DllStructGetData($tInfo, 'SubItem')) So, I store the column clicked in a global variable. If the column is clicked again (sort asc or desc) then all is fine, if another column then the one before is clicked, I unregister the callback and create a new one. The new callback (in the if) depends on the column clicked because of the content to sort (strings or numbers). Is there an easier / better way? Do I have to use my own sorting function with GuiCtrlRegisterListViewSort? Edit: It still doesn't work in every case (just noticed). Thanks Mega