Moderators Melba23 Posted September 29, 2022 Author Moderators Share Posted September 29, 2022 maniootek, That is what I was trying to do to solve your problem, but as the UDF has to react to a click on the item I could not find a way to disassociate the two events. I will keep looking. 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...
Champak Posted May 15, 2023 Share Posted May 15, 2023 New issue popped up. I have a function to add a set of rows at a time by ways of a loop with _GUIListViewEx_InsertSpec. If I add another set of rows AFTER the initial addition, it doesn't add at the point specified. But if I add a set of rows BEFORE the the initial addition, it inserts it where it's supposed to. The only way I found to fix this issue is to call _GUIListViewEx_ReadToArray and _GUIListViewEx_Init after each set is added. I don't want to do that because that takes up a lot of processing time (my list is big). Is there another way I can fix this issue without calling those two functions after every time I add rows? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 15, 2023 Author Moderators Share Posted May 15, 2023 Champak, Without a reproducer script to debug there is no way I can help you..... 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...
Champak Posted May 15, 2023 Share Posted May 15, 2023 OK, I'll get that for you tomorrow, in the meantime, if I have an element that is a dropdown select element, is it possible to also enter something new in it like a text input if the value I want isn't already pre programmed? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 15, 2023 Author Moderators Share Posted May 15, 2023 Champak, You should be able to do this - it all depends on the parameters you use in the _GUIListViewEx_SetEditStatus call: $iMode - 2 = Editable using combo ; $vParam1 = Content of combo - either delimited string or 0-based array ; $vParam2 = 0: editable combo (default); 1: readonly ; + 2 - Combo list automatically drops down on edit So setting $vParam2 to 0 (the default value) will get you an editable combo for that element. And testing it on Ex 6 in the UDF download package shows it works that way (I needed to modify line #53): ; Change _GUIListViewEx_SetEditStatus($iLVIndex_1, 2, 2, "1|2|3", 1) ; 2 = Read-only combo ; to read _GUIListViewEx_SetEditStatus($iLVIndex_1, 2, 2, "1|2|3", 0) ; 2 = Editable combo 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...
Champak Posted May 15, 2023 Share Posted May 15, 2023 Thanks for that. Found the problem. I added a condition to speed things up a little when adding multiple rows and it was the wrong value. Suggestion to add to the UDF for faster addition of rows if it is in a loop...I'm sure you'll find a better way: Change: _GUIListViewEx_InsertSpec($iLV_Index, $iRow, $vData, $fMultiRow = False, $fRetainWidth = False) To _GUIListViewEx_InsertSpec($iLV_Index, $iRow, $vData, $fMultiRow = False, $fRetainWidth = False, $custom_loop = 0) Change: If $aGLVEx_Data[0][15] Then To If $aGLVEx_Data[0][15] And $custom_loop = 0 Then That way the rewrite is only done on the last one. Although this will fail if for whatever reason the final count in the loop is not 0....that's where you would find a better way Then in the script I implemented like this ($iValue is the selected row, and $iValue2 is the amount of rows I want to add, when $k reaches 0 the list will redraw once): For $i = $iValue To $iValue2 $k = $iValue2 - $i _GUIListViewEx_InsertSpec($iLVIndex_1, $i, "", Default, Default, $k) Next Now I'm just trying to figure out how to color faster. This thing gets really slow with a very large list. Link to comment Share on other sites More sharing options...
Champak Posted May 15, 2023 Share Posted May 15, 2023 One more thing, I have an issue where in some cells in the excel file I import may contain pipes (|). This causes that particular row not to import into the listview. Is this something that has to do with autoit specifically, or is it something with this UDF? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 15, 2023 Author Moderators Share Posted May 15, 2023 Champak, Could I point you to this function in the UDF: ; #FUNCTION# ========================================================================================================= ; Name...........: _GUIListViewEx_BlockReDraw ; Description ...: Prevents ListView redrawing during looped Insert/Delete/Change calls It should allow you insert your multiple rows and then only redraw once everything has finished. As the the "pipe" problem, you can change the delimiter used by AutoIt using Opt("GUIDataSeparatorChar"). But you must do this BEFORE you start initialising ListViews as the UDF looks for and stores the current character at that point. I hope that helps. 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...
Champak Posted May 23, 2023 Share Posted May 23, 2023 Well, I'm glad you pointed that out to me, I told you you could do it better, and here I am thinking I'm doing something special lol. Is there a way to add the delimiter as a parameter specifically for the initialization function and then it goes back to default instead of the initialization looking at what autoit has it set to? This so I don't have to change it every time. I tried doing it, but it didn't work as expected, so curious if it's possible. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 23, 2023 Author Moderators Share Posted May 23, 2023 (edited) Champak, Try this Beta version of the UDF. I have added a function (_GUIListViewEx_RefreshDSC)to change the Data Separator Character that the UDF will use - note that this does NOT reset the main AutoIt data separator character. The function returns the current value, so you can reset the UDF when you no longer need the altered version. Give it a test and see what you think: If it works I will add the function header, etc. M23 Edited June 8, 2023 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 Link to comment Share on other sites More sharing options...
Champak Posted June 7, 2023 Share Posted June 7, 2023 So how exactly should this be used. I removed all instances of Opt("GUIDataSeparatorChar", "~") and I placed _GUIListViewEx_RefreshDSC("~") before every _GUIListViewEx_Init() and it doesn't seem to be working. Also, do I need to place it before all _GUIListViewEx_Init() or only before the Init where new files are being loaded? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 8, 2023 Author Moderators Share Posted June 8, 2023 Champak, Looking deeper into the problem, I see that it would be necessary to change the default separator character in BOTH the UDF and AutoIt to get this to work. This is because the UDF determines how to split the input for insertion, but AutoIt then determines how these strings should be displayed when the ListView is rewritten - so if they are not synchronised then the insertion will fail completely, or at best be incorrect. This raises a further problem as if the separator character is changed for one ListView, all the others will probably fail to redraw correctly when next asked as they will now be out of sync. Overall the choice of separator character would seem to me to be a "once in an execution" choice for any script using multiple ListViews - otherwise the synchronisation problem becomes far to complex to manage. This is true whether you use the UDF or not. So apologies, but I feel the answer to your problem lies with altering the input values from Excel to remove/alter the "|" characters so that there is no clash, rather then trying to get AutoIt (and the UDF) to accept them. 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...
Champak Posted July 16, 2023 Share Posted July 16, 2023 Three feature requests if you have the time. 1/ Ability to save and open different files...not just have a single file. I have an idea how I could accomplish this, but it would be convoluted and without a file dialogue. I hope that makes sense. 2/ Ability to save and open file with tags. I thought I didn't need this capability, so I fixed my script to scrub tags, but it so happens that I sometimes will need to add a font or br tag....as of now. 3/ Ability to changeitem for an entire row...which could hopefully be faster than individual items (I'm thinking in the same way as there are alternative ways to do _arrayadd to speed up the process in certain situations). Here is my scenario. I have a bunch of automation on multiple cells based on editing certain cells. This can be time consuming on a repetitive bases updating each cell with changeitem. Because of that I played around with simply editing with _GUICtrlListView_SetItemText and then when I'm finished editing that row, update everything with: _GUIListViewEx_ReadToArray() _GUIListViewEx_Init() _GUIListViewEx_ReturnArray() But that gets slower the larger the listview gets. I'm wondering if there is something else that can be done to address an entire row faster, or something that already exists in the UDF that I'm not seeing. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 16, 2023 Author Moderators Share Posted July 16, 2023 Champak, 1/ I am not sure what you mean by this request. You can already save to and load from any file by using its name in the relevant commands. Do you mean loading several files into the same ListView? 2/ I have no idea what you mean by saving and opening files with "tags". Do you mean saving additional information such as the font used? 3/ Perhaps simply deleting the whole line and then reinserting a line with the new data would suffice. Here is an example: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" Global $iCount = 20, $vRet, $iEditMode = 0 ; Create GUI $hGUI = GUICreate("LVEx Test", 640, 510) ; Create ListView $cListView = GUICtrlCreateListView("Tom|Dick|Harry|Peter|Paul|Mary", 10, 40, 600, 300, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetExtendedListViewStyle($cListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) For $i = 0 To 5 _GUICtrlListView_SetColumnWidth($cListView, $i, 93) Next ; Create array and fill listview Global $aLV_List[$iCount] For $i = 0 To UBound($aLV_List) - 1 $aLV_List[$i] = "Tom " & $i & "|Dick " & $i & "|Harry " & $i & "|Peter " & $i & "|Paul " & $i & "|Mary " & $i GUICtrlCreateListViewItem($aLV_List[$i], $cListView) Next ; Initiate LV $iLV_Index = _GUIListViewEx_Init($cListView, $aLV_List, 0, 0, True, 1 + 2 + 8) ; Create buttons $cRow_Edit = GUICtrlCreateButton("Insert", 10, 350, 200, 30) $cExit_Button = GUICtrlCreateButton("Exit", 430, 390, 200, 110) ; Register for sorting, dragging and editing _GUIListViewEx_MsgRegister() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $cExit_Button Exit Case $cRow_Edit ; Prepare new data $sNewLine = "New Tom " & "|New Dick " & "|New Harry " & "|New Peter " & "|New Paul " & "|New Mary " ; Here we get the last selected line, but it could be specified directly $sRet = _GUIListViewEx_GetLastSelItem($iLV_Index) $aRet = StringSplit($sRet, "|") $iIndex = $aRet[2] ; Now delete existing line... _GUIListViewEx_DeleteSpec($iLV_Index, $iIndex) ;...And then insert the new one _GUIListViewEx_InsertSpec($iLV_Index, $iIndex, $sNewLine) EndSwitch $vRet = _GUIListViewEx_EventMonitor($iEditMode) WEnd How does that work in your script? 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...
Champak Posted July 16, 2023 Share Posted July 16, 2023 1/ In writing a response to clarify what I was looking for it dawned on me exactly how to execute this without being convoluted. If that doesn't work I'll get back. 2/ If I save a listview with an html tag <br>, <font>, <span>, or a linefeed, it "corrupts" the listview file and errors out with an array issue when trying to reopen it. 3/ This seems to work great. I have to test it with another function, but I think it will do the trick, thanks. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 17, 2023 Author Moderators Share Posted July 17, 2023 Champak, 1/ Always ready to help if I can. 2/ I designed the UDF to work with text-only ListView elements - all bets are off if you use anything else. 3/ Delighted to hear 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 Link to comment Share on other sites More sharing options...
Champak Posted July 22, 2023 Share Posted July 22, 2023 (edited) When inserting a 2D array, (1) The colors don't shift with the text....the colored fields stay on their current index while the text will shift down. (2) You are no longer able to color rows below the inserted group of rows. It comes back with error (4) invalid row. On Example 6 under Case $cInsSpec I swapped the _GUIListViewEx_InsertSpec for: Local $aInsertA[5][4] _GUIListViewEx_InsertSpec($iLVIndex_1, $iValue, $aInsertA) and you'll be able to see what I mean. Edited July 22, 2023 by Champak Link to comment Share on other sites More sharing options...
Champak Posted July 24, 2023 Share Posted July 24, 2023 Also, when trying to save a listfile that had an array inserted I get the following error: (659) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $aData_Colour_Ordered[$i][$j] = $aData_Colour[$i][$aColOrder[$j + 1]] $aData_Colour_Ordered[$i][$j] = ^ ERROR Link to comment Share on other sites More sharing options...
Champak Posted July 24, 2023 Share Posted July 24, 2023 Lastly...for now....if I change a combo box, how do I reset the selected/viewable text? I have: $sAtt_Color1 = "~~Beige~Black~Blue~Brown~Burgundy~Cream~Green~Grey~Orange~Pink~Purple~Red~White~Yellow~Multi-Color" _GUIListViewEx_SetEditStatus($iLVIndex_1, $Col_OptionVal, 2, $sAtt_Color1 , 1 + 2) I tried _GUICtrlListView_SetItemText with a value of "" before and after the _GUIListViewEx_SetEditItem, but that deletes the contents of the dropdown. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 29, 2023 Author Moderators Share Posted July 29, 2023 Champak, Sorry for the late reply - I was away at a family funeral. Simple question first: To change the contents of the combo, just redeclare the "_SetEditStatus" line for that row with the new list of items. Difficult one next: I see the problem - looking into 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 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