LondonNDIB Posted January 2, 2015 Share Posted January 2, 2015 Well, since you asked: Ability to color or otherwise format the text in individual cells (I think I read somewhere you said you weren't going to do that, and I respect that) Any way to put checkboxes arbitrarily in a column instead of just the beginning of the row (somehow I think that's out of the scope of this UDF though) Any way to "check all", "uncheck all" and "invert" checked status of all rows' checkboxes (user can do this themselves, but it might be neater from within the UDF?) But really, no. It serves my purposes as-is. Link to comment Share on other sites More sharing options...
LondonNDIB Posted January 2, 2015 Share Posted January 2, 2015 (edited) WORKS PERFECTLY! Err... maybe there is a small flaw. I ran into a problem with my code whereby if I was trying to edit the VERY LAST cell (ie. bottom row, right-most column) I got an error. I then went with the basic example you provided with the beta and changed the code to change your "subitem 4-1" and I got the error again. Edited January 2, 2015 by LondonNDIB Link to comment Share on other sites More sharing options...
LondonNDIB Posted January 2, 2015 Share Posted January 2, 2015 Changing line 1115 From If $iRow < 0 Or $iRow > $iMax - 1 Then to If $iRow < 0 Or $iRow > $iMax Then Seems to have done the trick. But does that break something else? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 2, 2015 Author Moderators Share Posted January 2, 2015 (edited) LondonNDIB,Not the correct solution - as the internal array stored by the UDF adds a count in the [0][0] element, I need to add 1 to the specified row in line 1126. It helps knowing how the UDF works! In fact the example I posted shows the problem and I should have seen it earlier - we ask to change 3-1 and in fact it is 2-1 that is changed. :blush:Try this version:<snip>and this example:#include <GUIConstantsEx.au3> #include "GUIListViewEx_Mod.au3" Opt("MouseCoordMode", 0) ; Just to show that this still works $hGUI = GUICreate("Test", 500, 500) $cLV = GUICtrlCreateListView("Col 1 |Col 2 ", 10, 10, 480, 300) ;_GUICtrlListView_SetExtendedListViewStyle($cLV, BitOr($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT)) For $i = 0 To 4 GUICtrlCreateListViewItem("Item " & $i & "|SubItem " & $i & "-1", $cLV) Next ; Read content $aArray = _GUIListViewEx_ReadToArray($cLV) ; Initiate ListView $iLVIndex = _GUIListViewEx_Init($cLV, $aArray, 0, Default, 0, 2) $cButton_1 = GUICtrlCreateButton("Change Data", 10, 350, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton_1 $aArray = _GUIListViewEx_ReturnArray($iLVIndex) _ArrayDisplay($aArray, "Original", Default, 8) $aArray = _GUIListViewEx_ChangeItem($iLVIndex, 2, 0, "New 2-0") $aArray = _GUIListViewEx_ChangeItem($iLVIndex, 4, 1, "New 4-1") _ArrayDisplay($aArray, "Changed", Default, 8) EndSwitch WEndM23Edit:I have just seen your wish list - I am afraid they are all outside the scope of this UDF, which is quite complicated enough already. Sorry. > Edited January 7, 2015 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...
LondonNDIB Posted January 2, 2015 Share Posted January 2, 2015 No, I didn't suspect it would be the correct solution. Just a hack to get me by. Your fix fixed it (of course), ty! Re: wishlist... can't blame a guy for trying, right? Link to comment Share on other sites More sharing options...
LondonNDIB Posted January 2, 2015 Share Posted January 2, 2015 (edited) Ok, me again (won't this guy go away?). With this new change function... any chance it can also work with the checkboxes? Ie. programically check/uncheck? Perhaps adding a $iCheck = 0 parameter in the function call. $iCol would be ignored, of course. Then just check the status of $aCheck_Array at that row and invert it (or, if you want, have a "set" "unset" and "invert" as the possible values of $vValue). Sounds easy to me but I've already proven how little I know! Edited January 2, 2015 by LondonNDIB Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 2, 2015 Author Moderators Share Posted January 2, 2015 LondonNDIB,Just use the existing _GUICtrlListView_SetItemChecked function - no need for the UDF to do anything. 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...
LondonNDIB Posted January 2, 2015 Share Posted January 2, 2015 (edited) Right, sure... if you want to be all SIMPLE about it (lol, sometimes I forget the basics). Although... hmm... now I notice that the the _GUIListViewEx_ChangeItem function destroys check selections. Can they be preserved? edit: Would this be right? Found this line:Local $aCheck_Array[UBound($aData_Array)]and add to it like so: Local $aCheck_Array[UBound($aData_Array)] For $i = 1 To UBound($aCheck_Array) - 1 $aCheck_Array[$i] = _GUICtrlListView_GetItemChecked($hGLVEx_SrcHandle, $i - 1) Next Edited January 2, 2015 by LondonNDIB Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 2, 2015 Author Moderators Share Posted January 2, 2015 (edited) LondonNDIB,Some people are never satisfied - working on it... M23Edit:Try this function:expandcollapse popupFunc _GUIListViewEx_ChangeItem($iLV_Index, $iRow, $iCol, $vValue) ; Activate the ListView _GUIListViewEx_SetActive($iLV_Index) If @error Then Return SetError(1, 0, "") EndIf ; Check ListView is editable If $aGLVEx_Data[$iLV_Index][7] = "" Then Return SetError(2, 0, "") EndIf ; Check row and col values Local $iMax = _GUICtrlListView_GetItemCount($hGLVEx_SrcHandle) If $iRow < 0 Or $iRow > $iMax - 1 Then Return SetError(3, 0, "") EndIf $iMax = _GUICtrlListView_GetColumnCount($hGLVEx_SrcHandle) If $iCol < 0 Or $iCol > $iMax - 1 Then Return SetError(4, 0, "") EndIf ; Load array Local $aData_Array = $aGLVEx_Data[$iLV_Index][2] ; Create checkbox array Local $aCheck_Array = _GUIListViewEx_ReturnArray($iLV_Index, 1) If Not BitAnd($aGLVEx_Data[$iLV_Index][3], 1) Then _ArrayInsert($aCheck_Array, 0, $aData_Array[0][0]) EndIf ; Change item in array $aData_Array[$iRow + 1][$iCol] = $vValue ; Store modified array $aGLVEx_Data[$iLV_Index][2] = $aData_Array ; Rewrite ListView _GUIListViewEx_ReWriteLV($hGLVEx_SrcHandle, $aData_Array, $aCheck_Array, $iLV_Index) ; Return changed array Return _GUIListViewEx_ReturnArray($iLV_Index) EndFunc ;==>_GUIListViewEx_ChangeItem Edited January 2, 2015 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...
LondonNDIB Posted January 2, 2015 Share Posted January 2, 2015 Seems to do the trick! Link to comment Share on other sites More sharing options...
EpsilonZero Posted January 6, 2015 Share Posted January 6, 2015 Should this code in the UDF inside function _GUIListViewEx_EditHeader... ; Check ListView is editable If $aGLVEx_Data[$iLV_Index][7] = "" Then Return SetError(2, 0, $aRet) EndIf ...be the following to allow header edits to be blocked? ; Check ListView is editable If $aGLVEx_Data[$iLV_Index][7] = "" or $aGLVEx_Data[$iLV_Index][8] = "" Then Return SetError(2, 0, $aRet) EndIf I noticed that passing values to _GUIListViewEx_Init that didn't contain 8 still allowed headers to be edited and this seems to have fixed it for me. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 6, 2015 Author Moderators Share Posted January 6, 2015 EpsilonZero,It is just a simple typo - it should read $aGLVEx_Data[$iLV_Index][8] - thanks for the report, I will fix it in the release coming 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...
EpsilonZero Posted January 6, 2015 Share Posted January 6, 2015 I have a need for using both edit boxes and combo boxes, but didn't see a way to do it (it may just be me). With small modifications in _GUIListViewEx_EditProcess, I got it working for me: I changed this... ; And then for this column Local $sCombo_Data = $aComboData_Array[$aLocation[1]] If $sCombo_Data Then to this... ; And then for this column Local $sCombo_Data = $aComboData_Array[$aLocation[1]] If $sCombo_Data and $sCombo_Data<>'|' Then and this... Else ; No combo data available Return to this... Else ; No combo data available ;Return I also duplicated the mouse movements from ; Create temporary combo - get handle, set font size, give keyboard focus ... Local $aMPos = MouseGetPos() MouseMove($aMPos[0], $aMPos[1] + 20, 0) Sleep(10) MouseMove($aMPos[0], $aMPos[1], 0) ...under the following Else to make the edit box outline appear. Now, I just call _GUIListViewEx_Init with 32 in $iAdded always and call _GUIListViewEx_ComboData with an empty string for $vData for columns that I want to use as an edit box. I don't know if anyone else will find this useful or if I just didn't pay enough attention to get this working without changing things. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 6, 2015 Author Moderators Share Posted January 6, 2015 (edited) EpsilonZero,At first glance I can see a possible problem with that, but let me take a look at how both edits and combos might be available at the same time. No promises, mind. M23 Edited January 6, 2015 by Melba23 Typo 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 January 7, 2015 Author Moderators Share Posted January 7, 2015 (edited) EpsilonZero,I have implemented your "edit & combo" idea slightly differently. Setting the ListView "$iAdded" parameter to editable (2) will give you an edit on doubleclick unless you have set that column to use combos via a _GUIListViewEx_ComboData call. Now the whole thing is automatic and there is no need for a specific "combo" flag. Please test this Beta version and let me know if it works for you:<snip>Comments from others also welcome as always. M23 Edited January 7, 2015 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...
EpsilonZero Posted January 7, 2015 Share Posted January 7, 2015 The change works great and is intuitive. I had to add in the mouse movement to make the line edge of the edit box appear. I don't know if that is just XP or just me. One other change I made was commenting out one line at the end of _GUIListViewEx_EditProcess. ReDim $aEdited[$aEdited[0][0] + 1][2] I use the column that is being truncated to restore the original entry value if the new entry doesn't meet requirements (e.g. syntax). Thanks for the updates! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 7, 2015 Author Moderators Share Posted January 7, 2015 (edited) EpsilonZero,Glad you like it - and thanks for the idea. I don't know if that is just XP or just meI get the edit box to appear without the mouse movement - and no-one else has ever mentioned it - so I think it is just you. to restore the original entry value if the new entry doesn't meet requirementsHave you looked at the change I made in response to LondonNDIB's >feature request above? He wanted to do much the same thing, so I provided a function (_GUIListViewEx_ChangeItem) which can programatically change the ListView content. His idea was to look at the content before edit and then replace the original after edit if there was a syntax problem. Doing the same sort of thing would prevent you having to modify the actual UDF - which is always a bit delicate. M23 Edited January 7, 2015 by Melba23 Typo 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 January 7, 2015 Author Moderators Share Posted January 7, 2015 (edited) EpsilonZero,After looking more closely at your final suggestion I think it is an excellent one and I will expand on it by returning both the original and modified item values in that array - that way syntax checking will be really easy. M23Edit: And done (for header edits also). <snip> Edited January 7, 2015 by Melba23 Removed Beta code 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...
EpsilonZero Posted January 7, 2015 Share Posted January 7, 2015 The new changes work as advertised. I don't know what is causing my edit box drawing issue, but that's the only thing I have modified now aside from adding on per-line colorization of the listviews, though I will need to add a date input in addition to the existing edit and combo boxes in the near future. Thanks again! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 7, 2015 Author Moderators Share Posted January 7, 2015 (edited) [NEW VERSION] - 7 Jan 14Added: New function (_GUIListViewEx_ChangeItem) to allow ListView items to be changed programmatically.Changed:- No requirement to initialise combos when editing - using _GUIListViewEx_ComboData forces the defined column to use combos.- Return arrays after item or header edit now contain both original and new content to allow for checking and possible replacement (using the new function )Fixed: UDF will now run correctly regardless of whatever MouseCoordMode is set.Thanks to LondonNDIB and EpsilonZero for the reports/suggestions. New UDF in first post. M23 Edited January 7, 2015 by Melba23 Fixed BB codes 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