Moderators Melba23 Posted March 28, 2013 Author Moderators Share Posted March 28, 2013 (edited) Dana,The mode you run is immaterial as the edit idle loop does not use GUIGetMsg. The fact that you are getting the edit control makes it look as if the UDF is firing - so I am at a loss to see why it does not work correctly in your script. But after having seen only a few lines I am not altogether surprised (by my ignorance, not your coding!). I have no objection to looking through all the code if you want to send it to me - via PM if you prefer. M23 Edited March 28, 2013 by Melba23 Clarity! 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...
Moderators Melba23 Posted March 29, 2013 Author Moderators Share Posted March 29, 2013 Dana,Here is an a example of an editable ListView using the UDF running in OnEvent mode: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx_Mod.au3" #include <Array.au3> Opt("GUICloseOnESC", 0) Opt("GUIOnEventMode", 1) Global $iCount = 20, $iCount_Right = 20, $vData, $sMsg, $aLV_List, $aLV_List_Right ; Create GUI $hGUI = GUICreate("LVEx Example 1", 640, 430) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") ; Create Left ListView GUICtrlCreateLabel("Native ListView - Multiple selection - no count element - editable", 10, 15, 300, 20) $hListView = GUICtrlCreateListView("Tom|Dick|Harry", 10, 40, 300, 300, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_FULLROWSELECT) _GUICtrlListView_SetColumnWidth($hListView, 0, 93) _GUICtrlListView_SetColumnWidth($hListView, 1, 93) _GUICtrlListView_SetColumnWidth($hListView, 2, 93) ; Create array and fill Left listview Global $aLV_List[$iCount] For $i = 0 To UBound($aLV_List) - 1 If Mod($i, 5) Then $aLV_List[$i] = "Tom " & $i & "|Dick " & $i & "|Harry " & $i Else $aLV_List[$i] = "Tom " & $i & "||Harry " & $i EndIf GUICtrlCreateListViewItem($aLV_List[$i], $hListView) Next ; The array as loaded into the ListView _ArrayDisplay($aLV_List, "As loaded") ; Read array from the ListView $aLV_List = _GUIListViewEx_ReadToArray($hListView) ; The array as read from the ListView and used subsequently _ArrayDisplay($aLV_List, "As read") ; Initiate LVEx - no count parameter - default insert mark colour (black) - editable $iLV_Index = _GUIListViewEx_Init($hListView, $aLV_List, 0, 0, 2, True) $hDisplay_Button = GUICtrlCreateButton("Show Array", 430, 350, 100, 30) GUICtrlSetOnEvent(-1, "_ShowArray") $hExit_Button = GUICtrlCreateButton("Exit", 430, 390, 200, 30) GUICtrlSetOnEvent(-1, "_Exit") GUISetState() ; Register for dragging _GUIListViewEx_DragRegister(True, False, False) While 1 Sleep(10) $aRet = _GUIListViewEx_Edit() ; All columns editable _ArrayDisplay($aRet, @error) WEnd Func _ShowArray() $aLV_List = _GUIListViewEx_Return_Array($iLV_Index) If Not @error Then _ArrayDisplay($aLV_List, "Returned Left") Else MsgBox(0, "Left", "Empty Array") EndIf EndFunc Func _Exit() Exit EndFuncM23 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...
Dana Posted April 1, 2013 Share Posted April 1, 2013 Back from a long weekend with no coding... I found where the problem is, though I don't know how to fix it: Using the example code in the above post, I add to line 50, just above GUISetSTate(): GUICtrlSetFont($hListView, 7) This breaks the example script. Gotta go to a meeting now... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 1, 2013 Author Moderators Share Posted April 1, 2013 (edited) Dana,That is easy to explain - the temporary edit control refuses to show any text because the space allocated to it is too small. To fix it I either have to find a way of getting the current font size from the ListView - or add a parameter to the _GUIListViewEx_Edit function so that the edit control is set to a suitably-sized font within the UDF. M23Edit:Found just what I needed here - thank you KaFu. Try this new Beta version - with it I can determine the GUI or ListView font size and get the edit control to match: <snip>Second edit:Even newer Beta version which also sets the correct font type as well as size. < Code removed - see new Beta below > Edited April 18, 2013 by Melba23 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...
Dana Posted April 2, 2013 Share Posted April 2, 2013 Beautiful, thanks! One thing I see, if the while 1 loop passes through _GUIListViewEx_Edit with no edits made, @error is set to 1... is that intentional? I thought setting @error=1 is only if you try to edit a non editable column. One other thing: I have one of the buttons in my GUI has the $BS_DEFPUSHBUTTON style set, so that hitting enter causes that button to be pushed. When I edit a listview item and press enter to save the changes, that button also gets pushed. I tried changing that style to supress it, but it doesn't work: GUICtrlSetStyle($defbutton, -1) $editlist = _GUIListViewEx_Edit("1;2;3;4;5;6;7;8;9;10;11;12;13;14;15") ; column zero is not editable GUICtrlSetStyle($defbutton, $BS_DEFPUSHBUTTON) Actually, although you said, "Once edit started, all other script activity is suspended until following occurs...", clicking on any button in the GUI exits edit mode and the script continues. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 2, 2013 Author Moderators Share Posted April 2, 2013 (edited) Dana,When I run the example I do not get @error set with no edits: While 1 Sleep(10) $aRet = _GUIListViewEx_Edit("0;2") ; All columns editable $iError = @error If $iError <> 0 Then ConsoleWrite($iError & " @ " & @MSEC & @CRLF) _ArrayDisplay($aRet, @error) WEndAs you correctly state it should only be set when a non-editable column is clicked - which is what I see: ; Check if column is editable If $sCols Then If Not StringInStr(";" & $sCols, ";" & $aHit[1]) Then Return SetError(1, 0, $aEdited) EndIf EndIfI believe you cannot "unset" the $BS_DEFPUSHBUTTON style - I have tried on several occasions to change the default button as a script runs and I have never succeeded. I will look into how I might stop it acting - but you can of course also use the {TAB} key to accepts edits, although you do then have to tab to the end of the row. And looking at your _GUIListViewEx_Edit line I will also see what I can do to make the syntax a little easier - perhaps ("1-15") - but no promises! M23Edit: I also do not get the DEFPUSHBUTTON button firing on an edit {ENTER} - can you try this test script: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include "GUIListViewEx_Mod.au3" #include <Array.au3> Opt("GUICloseOnESC", 0) Opt("GUIOnEventMode", 1) Global $iCount = 20, $iCount_Right = 20, $vData, $sMsg, $aLV_List, $aLV_List_Right ; Create GUI $hGUI = GUICreate("LVEx Example 1", 640, 430) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") ; Create Left ListView GUICtrlCreateLabel("Native ListView - Multiple selection - no count element - editable", 10, 15, 300, 20) $hListView = GUICtrlCreateListView("Tom|Dick|Harry", 10, 40, 300, 300, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_FULLROWSELECT) _GUICtrlListView_SetColumnWidth($hListView, 0, 93) _GUICtrlListView_SetColumnWidth($hListView, 1, 93) _GUICtrlListView_SetColumnWidth($hListView, 2, 93) ; Create array and fill Left listview Global $aLV_List[$iCount] For $i = 0 To UBound($aLV_List) - 1 If Mod($i, 5) Then $aLV_List[$i] = "Tom " & $i & "|Dick " & $i & "|Harry " & $i Else $aLV_List[$i] = "Tom " & $i & "||Harry " & $i EndIf GUICtrlCreateListViewItem($aLV_List[$i], $hListView) Next ; The array as loaded into the ListView ;_ArrayDisplay($aLV_List, "As loaded") ; Read array from the ListView $aLV_List = _GUIListViewEx_ReadToArray($hListView) ; The array as read from the ListView and used subsequently ;_ArrayDisplay($aLV_List, "As read") ; Initiate LVEx - no count parameter - default insert mark colour (black) - editable $iLV_Index = _GUIListViewEx_Init($hListView, $aLV_List, 0, 0, 2, True) $hDisplay_Button = GUICtrlCreateButton("Show Array", 430, 350, 100, 30) GUICtrlSetOnEvent(-1, "_ShowArray") $hTest_Button = GUICtrlCreateButton("Test", 530, 350, 100, 30) GUICtrlSetStyle($hTest_Button, $BS_DEFPUSHBUTTON) GUICtrlSetOnEvent(-1, "_Test") $hExit_Button = GUICtrlCreateButton("Exit", 430, 390, 200, 30) GUICtrlSetOnEvent(-1, "_Exit") GUISetState() ; Register for dragging _GUIListViewEx_DragRegister(True, False, False) While 1 Sleep(10) $aRet = _GUIListViewEx_Edit("0;2") ; All columns editable $iError = @error If $iError <> 0 Then ConsoleWrite($iError & " @ " & @MSEC & @CRLF) _ArrayDisplay($aRet, @error) WEnd Func _Test() MsgBox(0, "Test", "Pressed") EndFunc Func _ShowArray() $aLV_List = _GUIListViewEx_Return_Array($iLV_Index) If Not @error Then _ArrayDisplay($aLV_List, "Returned Left") Else MsgBox(0, "Left", "Empty Array") EndIf EndFunc Func _Exit() Exit EndFunc Edited April 2, 2013 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 Link to comment Share on other sites More sharing options...
Dana Posted April 3, 2013 Share Posted April 3, 2013 Got it. The @error was being set not by your UDF, but by _ArrayDisplay($editlist, @error) where $editlist is the array returned (or rather, not returned) by _GUIListViewEx_Edit. I don't see a problem with the editable column listing syntax, unless perhaps somebody had a lot more columns than I do here. Your example does not exhibit the defbutton problem that mine does, but I found a workaround. GUICtrlSetOnEvent($defbutton, "") $editlist = _GUIListViewEx_Edit("1;2;3;4;5;6;7;8;9;10;11;12;13;14;15") ; column zero is not editable GUICtrlSetOnEvent($defbutton, "AddClicked") Still the default button, but it doesn't go anywhere while the UDF is active. I think everything works now Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 3, 2013 Author Moderators Share Posted April 3, 2013 Dana, Excellent news! I am working on the range expanasion - expect a new release soon. 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...
Dana Posted April 4, 2013 Share Posted April 4, 2013 Working on rewriting my edit functions to use this UDF now, and I can think of two useful improvements. I don't know how easy it would be, of course anything is easy for the person not doing it , but anyway:Make it possible to pass _GUIListViewEx_Edit two optional integer parameters so that it rather than looking for a doubleclick, it opens the specified cell for editing as if you had doubleclicked on it. The default (omitted or -1,-1, for example) would be the current behavior.Along with {TAB} moving to the next cell, how about the arrow keys (up/down as well as right/left)? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 4, 2013 Author Moderators Share Posted April 4, 2013 Dana, I think an additional function would be a better solution to the first request. I will look into it this afternoon. As for the second request - use a spreadsheet! Seriously, I will look into that as well. 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...
Moderators Melba23 Posted April 4, 2013 Author Moderators Share Posted April 4, 2013 Dana,New function working nicely - I have called it _GUIListViewEx_EditItem and you call it with the index of the ListView to edit, the row and column data, and a Boolean parameter to tell the UDF whether it is to return immediately after the edit or if it is to enter the multiple item edit mode if "{TAB}" is pressed. Now to work on the arrow keys. 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...
Moderators Melba23 Posted April 4, 2013 Author Moderators Share Posted April 4, 2013 (edited) Dana & anyone else reading,A new Beta which moves the edit with the arrow keys - if you allow it to do so. Note that there are some script-breaking changes in this one so be careful if you try to use it with anything other that the example below. UDF and example<Code removed - see new Beta below>All comments welcome. If you break it, an explanation of exactly how you managed it would be appreciated. M23 Edited April 18, 2013 by Melba23 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...
mesale0077 Posted April 4, 2013 Share Posted April 4, 2013 line errorFunc _GUIListViewEx_Editonclick($fImmRet = True, $iDelta_X = 0, $iDelta_Y = 0) Link to comment Share on other sites More sharing options...
BrewManNH Posted April 4, 2013 Share Posted April 4, 2013 line errorFunc _GUIListViewEx_Editonclick($fImmRet = True, $iDelta_X = 0, $iDelta_Y = 0)Forum software corrupted that line, easy fix. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 6, 2013 Author Moderators Share Posted April 6, 2013 (edited) Dana and others, I am looking to refine the UDF to meet user expectations. When you move the edit control around with the keys, what would you prefer to happen when you reach an edge? At the moment the editing process terminates - but it could quite easily be modified to remain on the last valid column/row. Or would you like this behaviour to be user-defined via a suitable parameter? M23 Edit: Or should the edit control move to the other end/side and loop? Any or all of those 3 options should be possible. Edit 2: It was really easy to add all 3 options plus the single edit to be user-defined using an existing parameter - so I have done just that. Edited April 6, 2013 by Melba23 mesale0077 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 Link to comment Share on other sites More sharing options...
Dana Posted April 8, 2013 Share Posted April 8, 2013 I like it. From my standpoint, I would think looping around to the opposite end of the current line makes the most sense when arrowing right or left. Up or down, I dunno... moving from the end or the beginning of the listview makes less sense, especially if it's a long list... there it might make more sense to terminate the edit. What would be nice is to allow a mouse click elsewhere move the edit focus to where you click. Link to comment Share on other sites More sharing options...
Dana Posted April 8, 2013 Share Posted April 8, 2013 Something either not working or I don't understand it. I have: $iLVIndex = _GUIListViewEx_Init($hdatalist, $listarray, 1, 0xFF0000, 2, False, "1-15") _GUIListViewEx_DragRegister(True, False, True) ; enable notify but not dragging While 1 Sleep(100) ; keep the GUI from eating up all the CPU cycles If Not $setupmode Then GUICtrlSetOnEvent($addbutton, "") ; disable $addbutton while editing so the closing enter saving the edits doesn't invoke $addbutton $editlist = _GUIListViewEx_Editonclick(0) GUICtrlSetOnEvent($addbutton, "AddClicked") ; reenable $addbutton If @error Then ConsoleWrite("Line 313: " & @error & " at " & @MIN & @SEC & @CRLF) Else _ArrayDisplay($editlist, @error) if IsArray($editlist) then SaveData() EndIf EndIf ;some more stuff here Wend func SaveData() $numedits = $editlist[0][0] msgbox(4096, "debug", "saving " & $numedits & " edits") For $e = 1 to $numedits consolewrite($e & ": " & $editlist[$e][0] & ", " & $editlist[$e][1] & @CRLF) consolewrite($e & ": " & $listarray[$editlist[$e][0]][$editlist[$e][1]] & @CRLF) Next EndFunc When I run this, ConsoleWrite is showing the original values in $listarray, not the altered values. Is this intended so that I need to retrive the edited value from the listview itself, and if so what's the point of passing the array to _GUIListViewEx_Init? Link to comment Share on other sites More sharing options...
Dana Posted April 10, 2013 Share Posted April 10, 2013 No problem with the above if I use _GUICtrlListView_GetItemText to read the edited value back from the array, but I found a different bug: If I try to edit the last line in the listview, I get an error: GUIListViewEx_Mod.au3 (1592) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $aGLVEx_Array[$aLocation[0] + 1][$aLocation[1]] = $sItemNewText ^ ERROR This happens if I hit <enter> to complete the edit or if I hit <tab> to move to the next cell. Link to comment Share on other sites More sharing options...
Clark Posted April 11, 2013 Share Posted April 11, 2013 I can't believe that on 11 April 2013 I have a need for a listboxview with inline edit capabilities, and on 1 April 2013 you post a UDF to do exactly that! Well done old bean! Link to comment Share on other sites More sharing options...
Dana Posted April 11, 2013 Share Posted April 11, 2013 Here's another issue, I won't call it a bug: Using _GUIListViewEx_EditItem, if the item to be edited is outside the displayed area of the [scrolled] listview, the edit field opens up where it would be, outside the listview window. Simple enough to solve using _GUICtrlListView_Scroll, but it would make sense for EditItem to automatically scroll to it if necessary. I'm creating new lines at the end of the list by adding a blank line (using GUICtrlCreateListViewItem), scrolling to the end, and then using _GUIListViewEx_EditItem to fill it in... this is how I found the above issue with editing the last line. Link to comment Share on other sites More sharing options...
Recommended Posts