Moderators Melba23 Posted October 1, 2014 Author Moderators Posted October 1, 2014 (edited) mjolnirmarkiv,Found it. I created a new struct in the code to fix the last bug and gave it the same name as an existing one. :blush:Try this one where I have renamed it:<snip>M23 Edited October 2, 2014 by Melba23 Beta code removed 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
mjolnirmarkiv Posted October 2, 2014 Posted October 2, 2014 Thak you, Melba23, that works. BTW another bug (apparently introduced with previous update, not that one) I've encountered couple of times but never was able to reproduce on purpose is undeclared var $fExitLoop at line 2080. Probably just declaring it beforehand will fix the problem. Will report back if will find a convenient way to reproduce it, for now edit beginedit cancel hectically for a long enough works half of the time.
Moderators Melba23 Posted October 2, 2014 Author Moderators Posted October 2, 2014 mjolnirmarkiv,Ahead of you this time - it was first declared within a conditional structure, but not any longer. I will release a new version today. 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
Moderators Melba23 Posted October 2, 2014 Author Moderators Posted October 2, 2014 [bUGFIX VERSION] - 2 Oct 14Fixed: A second bug introduced by the last update - the lesson is not to code when you have influenza! :blush:New UDF in the first post. 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
mjolnirmarkiv Posted October 4, 2014 Posted October 4, 2014 (edited) Not to spoil your day but there's another one tiny bug tab key doesn't work like it should, probably because it checks for loss of focus before it check fot pressed tab: ; Temp input lost focus If _WinAPI_GetFocus() <> $hTemp_Edit Then $fExitLoop = True EndIf On a side note, I wonder what is the type of variables in array in $aGLVEx_Data[n][4]? VarGetType returns a "String", but I guess it should be boolean? Anyway I'm not getting desired results when trying to sort an array on column click, retrieving sort status from $aGLVEx_Data[1][4] in function that runs on $WM_NOTIFY: Case $LVN_COLUMNCLICK Local $dll_struct = DllStructCreate ("hwnd;uint_ptr;int_ptr;int;int", $l_param) Local $col = DllStructGetData ($dll_struct, 5) Local $sort_status = $aGLVEx_Data[1][4] _ArraySort ($settings, $sort_status[$col], 0, 0, $col) BUT if I do track sort status on my own it works: Case $LVN_COLUMNCLICK Local $dll_struct = DllStructCreate ("hwnd;uint_ptr;int_ptr;int;int", $l_param) Local $col = DllStructGetData ($dll_struct, 5) _ArraySort ($settings, $sort_order[$col], 0, 0, $col) $sort_order[$col] = not $sort_order[$col] Edited October 4, 2014 by mjolnirmarkiv
Moderators Melba23 Posted October 4, 2014 Author Moderators Posted October 4, 2014 mjolnirmarkiv,You are not spoiling my day at all - although as usual you are not giving me anywhere near enough information to work on. tab key doesn't work like it shouldSo how do you expect the TAB key to work? What is it doing now that you consider unexpected? Do you expect it to add a TAB character to the text inside the edit? I'm not getting desired results when trying to sort an array on column clickWhy are you not using the UDF's built-in column sort functionality? That uses the _GUICtrlListView_SimpleSort function which requires a $vSortSense parameter for each column - which is what is stored in the [n][4] element of . _ArraySort needs nothing of the sort (pun intended) - so it is hardly surprising that you need to track your own sort. Using internal UDF elements in your own functions is not recommended. 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
mjolnirmarkiv Posted October 4, 2014 Posted October 4, 2014 (edited) So how do you expect the TAB key to work? What is it doing now that you consider unexpected? Do you expect it to add a TAB character to the text inside the edit? In my case tab should work like Ctrl-Right arrow, i.e. moves to next item, but it cancels the edit completely. Why are you not using the UDF's built-in column sort functionality? That uses the _GUICtrlListView_SimpleSort function which requires a $vSortSense parameter for each column - which is what is stored in the [n][4] element of . _ArraySort needs nothing of the sort (pun intended) - so it is hardly surprising that you need to track your own sort. Using internal UDF elements in your own functions is not recommended. I do use it, but that's not the point. I have a $settings array that includes all inputed data from all controls within the GUI (so it's not an array of items listview holds). There's main listview that holds profile names and depending on the choice of profile rest of controls are filled with data. When I sort it, naturally I want $settings array to mimick it and get it sorted accordingly. Of course, I could track sort order by myself, but if it's stored in [n][4], I thought I just could use it. Edited October 4, 2014 by mjolnirmarkiv
Moderators Melba23 Posted October 4, 2014 Author Moderators Posted October 4, 2014 mjolnirmarkiv, In my case tab should work like Ctrl-Right arrowBut it does not in this UDF and I am not adding it. The value held in [n][4] is an array with as many elements as columns - reading the [$iCol] element will get you the current sort state (0/1). I have just run a test and it definitely works and looking at the code you posted above I see no reason for it not to work either - it is almost identical to the test code I ran.But a word of caution - unless the elements of the array are identical to the elements of the ListView the sort may not be identical either. If you were to go down this route I would suggest having a 2D array where the [0] column is the same as the ListView and thus will sort the in same order, with your other data in the [1] column which you can then extract after the sort. Does that make sense? 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
Moderators Melba23 Posted October 4, 2014 Author Moderators Posted October 4, 2014 mjolnirmarkiv,Another thought - why not add a hidden column to the ListView? That way the sort order will always be correct and you can get the sorted array any time you wish using the _GUIListViewEx_ReturnArray function - _ArrayExtract should return you the specific data you require. 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
mjolnirmarkiv Posted October 4, 2014 Posted October 4, 2014 (edited) But it does not in this UDF and I am not adding it. Hmm, I might have misunderstood it's functionality then. I clearly remember it moved me to the next item last time I checked (I'm using edit mode = 33) :/ Any way never mind, it's fine both ways. The value held in [n][4] is an array with as many elements as columns - reading the [$iCol] element will get you the current sort state (0/1). I have just run a test and it definitely works and looking at the code you posted above I see no reason for it not to work either - it is almost identical to the test code I ran. Not a big deal either, I could track sorting. Just out of curiosity what does this returns you on F1? #include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <GUIListViewEx.au3> HotKeySet ("{F1}", "Debug") Global $gui = GUICreate ("My App", 200, 100, -1, -1) Global $listview = GUICtrlCreateListView ("Col 0|Col 1", 10, 10, 180, 80) Global $arr[2][2] = [["a", "b"], ["c", "d"]] _GUICtrlListView_AddArray ($listview, $arr) Global $listview_index = _GUIListViewEx_Init ($listview, "", 0, 0xFF0000, true, 3) _GUIListViewEx_SetActive ($listview_index) _GUIListViewEx_MsgRegister (true, true, true) GUISetState (@SW_SHOW, $gui) Global $gui_message While $gui_message <> $GUI_EVENT_CLOSE $gui_message = GUIGetMsg () WEnd Func Debug () $a = $aGLVEx_Data[1][4] MsgBox (0, "", $a[0]) EndFunc Because I'm getting emtpy string regardless UPD: Updated with fully functional test. Am I missing here smth? UPD2: Forgot to actually add items to lsitview, fixed. Edited October 4, 2014 by mjolnirmarkiv
Moderators Melba23 Posted October 4, 2014 Author Moderators Posted October 4, 2014 mjolnirmarkiv, I clearly remember it moved me to the next item last time I checkedMy apologies - you are quire right. I will look into why it no longer does so. I'm getting emtpy stringThe array is created empty - as AutoIt regards an empty string as False and so it is equivalent to "0". The code I used check for this value earlier was:Local $aLVSortState = $aGLVEx_Data[$iLV_Index][4] $iDescending = ( ($aLVSortState[$iCol] = 1) ? (1) : (0) ) ; Force either 1/0 _ArraySort($aTest_List, $iDescending)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
Moderators Melba23 Posted October 4, 2014 Author Moderators Posted October 4, 2014 mjolnirmarkiv,Your guess in post #245 above was correct - I had moved the focus check ahead of the key check. Good spot. 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
mjolnirmarkiv Posted October 4, 2014 Posted October 4, 2014 mjolnirmarkiv, The array is created empty - as AutoIt regards an empty string as False and so it is equivalent to "0". The code I used check for this value earlier was: Local $aLVSortState = $aGLVEx_Data[$iLV_Index][4] $iDescending = ( ($aLVSortState[$iCol] = 1) ? (1) : (0) ) ; Force either 1/0 _ArraySort($aTest_List, $iDescending) M23 A-ha, now I'm getting smth, thanks. My original script still returns nothing though :/ But at least test script is working. Probably has interfered somewhere along the way. At least I know there's nothing wrong with UDF.
mjolnirmarkiv Posted October 6, 2014 Posted October 6, 2014 (edited) Hi Melba23, Getting back to that sorting issue, after all there's a typo in UDF: ; Load current ListView sort state array Local $aLVSortState = $aGLVEx_Data[$aGLVEx_Data[0][0]][4] ; Sort column - get column from from struct _GUICtrlListView_SimpleSort($hGLVEx_SrcHandle, $aLVSortState, $iCol) ; Store new ListView sort state array $aGLVEx_Data[$aGLVEx_Data[0][0]][4] = $aLVSortState I was getting correct results in test script because I've got only one listview there, but in the original script I've got five, so naturally "0" should be "1" in $aGLVEx_Data[$aGLVEx_Data[0][0]][4] (or $aGLVEx_Data[$iLV_Index][4] for the sake of simplicity). Edited October 6, 2014 by mjolnirmarkiv
Moderators Melba23 Posted October 6, 2014 Author Moderators Posted October 6, 2014 mjolnirmarkiv,For once I might just be ahead of you. I had already noticed that and I have rewritten that section to use the index returned when searching through the initiated ListView array: ; Load current ListView sort state array Local $aLVSortState = $aGLVEx_Data[$iLV_Index][4] ; Sort column - get column from from struct _GUICtrlListView_SimpleSort($hGLVEx_SrcHandle, $aLVSortState, $iCol) ; Store new ListView sort state array $aGLVEx_Data[$iLV_Index][4] = $aLVSortStateM23 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
Moderators Melba23 Posted October 9, 2014 Author Moderators Posted October 9, 2014 [NEW VERSION] - 9 Oct 14Added: mjolnirmarkiv has been most helpful in pointing out small improvements that could be made - so as a payback I have added something that he requested. The UDF now reads the current delimiter/separator character and uses that in place of using a default "|". If you do not change the default character then you need do nothing - but if you do change the character then you must do so using Opt("GUIDataSeparatorChar", ) before you include the UDF file so that it is correctly set.New UDF in the first post. M23 mjolnirmarkiv 1 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
nobbitry Posted October 11, 2014 Posted October 11, 2014 (edited) Hello M23, I just used the UDF the first time, and it made my work wonderfully simple. I will use it often. Big thanks for that. In one case I had to modify it for my use, if I didn't miss something.. I had a main Listview with Items I that wanted to insert into different lists. So I didn't want them to be deleted in the main Listview. I simply commented the lines out. Maybe it could be useful to make that a parameter of Listviews. ; Delete dragged element(s) from source array For $i = 0 To $iMultipleItems _GUIListViewEx_Array_Delete($aGLVEx_SrcArray, $iGLVEx_DraggedIndex + 1) Next nobbitry Edited October 11, 2014 by nobbitry
Moderators Melba23 Posted October 11, 2014 Author Moderators Posted October 11, 2014 nobbitry,An interesting idea - thanks for the suggestion. I will look into how I might introduce it. 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
Moderators Melba23 Posted October 12, 2014 Author Moderators Posted October 12, 2014 (edited) nobbitry, As not deleting from a ListView on drag means that you should not be able to drop back into it again (or else you could get multiple identical rows) I have modified the UDF to separate the drag/drop permissions. Whereas before you could only make a ListView refuse to both drag and drop, you can now set the 2 permissions separately - and I have added a new parameter to prevent deletion on drag. Look in the _GUIListViewEx_Init header to see the required values. Please play with this Beta version and example and let me know if it does what you require: And comments welcome from anyone else also welcome. M23 Edit: And welcome to the AutoIt forums. Edited September 27, 2017 by Melba23 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
nobbitry Posted October 13, 2014 Posted October 13, 2014 Hello M23, Sounds great! I will test it. Please excuse the late reply. Somehow the email notifications do not work yet.. nobbitry
Recommended Posts