Bug in Array Display over 3999 items; presumably so in any ListView GUI?; only in beta (10 anyway), not production.
Best, Randall
Posted 14 November 2007 - 09:32 PM
Posted 15 November 2007 - 04:31 AM
Remarks
You can not use this function to insert subitems. Use _GUICtrlListView_SetItemText to insert subitems.
Edited by -Ultima-, 15 November 2007 - 04:39 AM.
Posted 15 November 2007 - 05:56 AM
Posted 15 November 2007 - 07:48 AM
Posted 19 November 2007 - 12:50 AM
Hi,
True,
But it still needs to be fixed by whomever changed it to new UDF type; ? garyfrost?
best, randall
SciTE for AutoItDirections for Submitting Standard UDFs
Don't argue with an idiot; people watching may not be able to tell the difference.
Posted 21 November 2007 - 11:54 AM
Hi,Now that we have the callback feature, I'm going to look into replacing the simplesort with a callback, then won't need the arraysort.
If your going to keep using the listview functions in the _ArrayDisplay you'll need to stringsplit and set the subitems
Func _GUICtrlListView_AddItemRow($hListView, $m, $avArrayText, $Sep) Local $arItems = StringSplit($avArrayText, $Sep) _GUICtrlListView_AddItem ($hListView, $arItems[1], $m) If UBound($arItems) < 2 Then Return 1 For $k = 2 To UBound($arItems) - 1 _GUICtrlListView_AddSubItem ($hListView, $m, $arItems[$k], $k-1) Next Return 1 EndFunc ;==>_GUICtrlListView_AddItems
Posted 21 November 2007 - 03:27 PM
;=============================================================================== ; ; Function Name: _ArrayDisplay() ; Description: Displays given 1D or 2D array array in a listview. ; ; Parameter(s): $avArray - Array to display ; $sTitle - [optional] Title to use for window ; $iItemLimit - [optional] Maximum number of listview items (rows) to show ; $iTranspose - [optional] If set differently than default, will transpose the array if 2D ; $sSeparator - [optional] Change Opt("GUIDataSeparatorChar") on-the-fly ; $sReplace - [optional] String to replace any occurrence of $sSeparators with in each array elements ; ; Return Value(s): Success - Returns 1 ; Failure - Returns 0 and sets @error ; @Error - 1 = $avArray is not an array ; 2 = $avArray has too many dimensions (only up to 2D supported) ; ; Author(s): Ultima ; ;=============================================================================== Func _ArrayDisplay(Const ByRef $avArray, $sTitle = "Array: ListView Display", $iItemLimit = -1, $iTranspose = 0, $sSeparator = "|", $sReplace = "~") If Not IsArray($avArray) Then Return SetError(1, 0, 0) ; Dimension checking Local $iDimension = UBound($avArray, 0), $iUBound = UBound($avArray, 1), $iSubItems = UBound($avArray, 2) If $iDimension > 2 Then Return SetError(2, 0, 0) ; Hard limits Local $iColLimit = 250, $iLVIAddUDFThreshold = 4000, $iWidth = 640, $iHeight = 480 If $iItemLimit = 1 Then $iItemLimit = $iLVIAddUDFThreshold ; Declare/define variables Local $i, $j, $avArrayText, $aiCurItem, $sHeader = "Row" Local $iOnEventMode = Opt("GUIOnEventMode", 0), $sDataSeparatorChar = Opt("GUIDataSeparatorChar", $sSeparator) ; Swap dimensions if transposing and array is 2D If $iTranspose And $iDimension > 1 Then Local $tmp = $iUBound $iUBound = $iSubItems $iSubItems = $tmp EndIf ; Set limits for dimensions If Not $iUBound Then $iUBound = 1 If Not $iSubItems Then $iSubItems = 1 If $iSubItems > $iColLimit Then $iSubItems = $iColLimit If $iItemLimit < 1 Then $iItemLimit = $iUBound If $iUBound > $iItemLimit Then $iUBound = $iItemLimit If $iLVIAddUDFThreshold > $iUBound - 1 Then $iLVIAddUDFThreshold = $iUBound - 1 ; Convert array into text for listview Dim $avArrayText[$iUBound] If $iDimension = 1 Then For $i = 0 To $iUBound - 1 $avArrayText[$i] = "[" & $i & "]" & $sSeparator & StringReplace($avArray[$i], $sSeparator, $sReplace, 0, 1) Next ElseIf $iTranspose Then For $i = 0 To $iUBound - 1 $avArrayText[$i] = "[" & $i & "]" For $j = 0 To $iSubItems - 1 $avArrayText[$i] &= $sSeparator & StringReplace($avArray[$j][$i], $sSeparator, $sReplace, 0, 1) Next Next Else For $i = 0 To $iUBound - 1 $avArrayText[$i] = "[" & $i & "]" For $j = 0 To $iSubItems - 1 $avArrayText[$i] &= $sSeparator & StringReplace($avArray[$i][$j], $sSeparator, $sReplace, 0, 1) Next Next EndIf ; Set header up For $i = 0 To $iSubItems - 1 $sHeader &= $sSeparator & "Col " & $i Next ; Set interface up Local $hGUI = GUICreate($sTitle, $iWidth, $iHeight, Default, Default, $WS_SIZEBOX + $WS_MINIMIZEBOX + $WS_MAXIMIZEBOX) Local $aiGUISize = WinGetClientSize($hGUI) Local $hListView = GUICtrlCreateListView($sHeader, 0, 0, $aiGUISize[0], $aiGUISize[1]-26, $LVS_SHOWSELALWAYS, $LVS_EX_FULLROWSELECT + $WS_EX_CLIENTEDGE) Local $hCopy = GUICtrlCreateButton("Copy Selected", 3, $aiGUISize[1]-23, $aiGUISize[0]-6, 20) GUICtrlSetResizing($hListView, $GUI_DOCKBORDERS) GUICtrlSetResizing($hCopy, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT) GUICtrlSendMsg($hListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) ; Fill listview For $i = 0 To $iLVIAddUDFThreshold GUICtrlCreateListViewItem($avArrayText[$i], $hListView) Next For $i = ($iLVIAddUDFThreshold + 1) To ($iUBound - 1) _GUICtrlListView_InsertItem($hListView, "") _GUICtrlListView_SetItemText($hListView, $i, $avArrayText[$i], -1) Next ; Show dialog GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $hCopy Local $sClip = "" $aiCurItem = _GUICtrlListView_GetSelectedIndices($hListView, True) If Not $aiCurItem[0] Then For $i = 0 To $iUBound - 1 $sClip &= $avArrayText[$i] & @CRLF Next Else For $i = 1 To UBound($aiCurItem) - 1 $sClip &= $avArrayText[$aiCurItem[$i]] & @CRLF Next EndIf ClipPut($sClip) EndSwitch WEnd GUIDelete($hGUI) Opt("GUIOnEventMode", $iOnEventMode) Opt("GUIDataSeparatorChar", $sDataSeparatorChar) Return 1 EndFunc ;==>_ArrayDisplay
_GUICtrlListView_InsertItem($hListView, "") _GUICtrlListView_SetItemText($hListView, $i, $avArrayText[$i], -1)
Edited by -Ultima-, 21 November 2007 - 03:40 PM.
Posted 21 November 2007 - 09:28 PM
thanks!_GUICtrlListView_InsertItem($hListView, "") _GUICtrlListView_SetItemText($hListView, $i, $avArrayText[$i], -1)
It's as simple as doing this
Edit: @GaryFrost: I think you need to update the function header to note that -1 means that it'll set the text for each subitem.
Posted 22 December 2007 - 10:31 PM
Posted 22 December 2007 - 11:21 PM
Hi,@randallc, @jos
where do we put the Ultima proposal which fix the issue?
I propose to put it in debug.au3 and in the same time change the name to _DebugArrayDisplay()
Edited by randallc, 23 December 2007 - 12:03 PM.
Posted 22 December 2007 - 11:35 PM
Posted 23 December 2007 - 08:43 AM
Visit the SciTE4AutoIt3 Download page for the latest versions Forum Rules
Live for the present,
Dream of the future,
Learn from the past.
Posted 23 December 2007 - 08:53 AM
I don't see why it's such a script breaker. I have never heard of any one using it for any purpose than debugging and that's really the only thing it's any good for. I would never dream of #including that the current array.au3 file (in a final script) without removing the array display function first. The reason I won't #include array.au3 is because of that function.I prefer all these changes to go into the newly developed array.au3 and start using that soon in the new Beta to give it time to discover any Bugs and fix these issues before the next Production release.
I don't see why we should move ArrayDisplay since that will break current scripts and its an Array UDF. Understand its mostly used for debugging purpose but it has been in Array since day one.
Jos
Posted 23 December 2007 - 09:42 AM
There are other solutions to avoid the addition of too much extra weight to your script due to this UDF.I don't see why it's such a script breaker. I have never heard of any one using it for any purpose than debugging and that's really the only thing it's any good for. I would never dream of #including that the current array.au3 file (in a final script) without removing the array display function first. The reason I won't #include array.au3 is because of that function.
Edited by Jos, 23 December 2007 - 09:42 AM.
Visit the SciTE4AutoIt3 Download page for the latest versions Forum Rules
Live for the present,
Dream of the future,
Learn from the past.
Posted 23 December 2007 - 10:35 AM
Posted 23 December 2007 - 03:10 PM
Those aren't solutions, they don't fix the problem, which is the bloat this function introduces. They are just work-arounds to reduce the bloat after-the-fact. JP summed up the solutions. Either this function gets trimmed down to be a MsgBox() again or it goes to a different file.There are other solutions to avoid the addition of too much extra weight to your script due to this UDF.
Posted 23 December 2007 - 05:32 PM
Posted 23 December 2007 - 05:34 PM
Posted 23 December 2007 - 05:45 PM
Agreed that it's a livable solution. But I will probably continue to move it to the debug.au3 file anyway. Or at least put a copy in there as __ArrayDisplay() while continuing to #include arrayx.au3 My big concern (like you) was the fact that the function previously required inclusion of GUIConstants.au3. I am aware that the GUIConstants.au3 has changed as well so it (hopefully) won't be the nightmare that it used to be.Gary has re-written the function not to #include anything else. To me, that's an acceptable solution.
Posted 23 December 2007 - 05:49 PM
Agreed that it's a livable solution. But I will probably continue to move it to the debug.au3 file anyway. Or at least put a copy in there as __ArrayDisplay() while continuing to #include arrayx.au3 My big concern (like you) was the fact that the function previously required inclusion of GUIConstants.au3. I am aware that the GUIConstants.au3 has changed as well so it (hopefully) won't be the nightmare that it used to be.
SciTE for AutoItDirections for Submitting Standard UDFs
Don't argue with an idiot; people watching may not be able to tell the difference.
0 members, 0 guests, 0 anonymous users