Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Bug in Array Display over 3999 items


  • Please log in to reply
30 replies to this topic

#1 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 14 November 2007 - 09:32 PM

Hi,
Bug in Array Display over 3999 items; presumably so in any ListView GUI?; only in beta (10 anyway), not production.
; arraydispBug2.au3 #include<array.au3> local $Files [4001] for $i=0 to 4000     $Files [$i]=$i Next _ArrayDisplay($Files)
Look at item 3999;
Best, Randall







#2 -Ultima-

-Ultima-

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 267 posts

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.

[ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ]

#3 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 15 November 2007 - 05:56 AM

Hi,
True,
But it still needs to be fixed by whomever changed it to new UDF type; ? garyfrost?
best, randall

#4 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 15 November 2007 - 07:48 AM

Why does it only draw 1/2 of the last term?

#5 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

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


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

SciTE for AutoItDirections for Submitting Standard UDFs

Don't argue with an idiot; people watching may not be able to tell the difference.


#6 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 21 November 2007 - 11:54 AM

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

Hi,
I have no idea what the dllcallback does! Nor why it is relevant to _ArrayDisplay?....


Oh well, i'll learn 1 day..

Meantime, I have proposed a fix to _ArrayDisplay ; "_ArrayDebugDisplay"
_ArrayDebugDisplay
and maybe you could add this to yours?
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
Best, Randall

#7 -Ultima-

-Ultima-

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 267 posts

Posted 21 November 2007 - 03:27 PM

O.o

AutoIt         
;=============================================================================== ; ; 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)

It's as simple as doing this :P

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.

Edited by -Ultima-, 21 November 2007 - 03:40 PM.

[ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ]

#8 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 21 November 2007 - 09:28 PM

        _GUICtrlListView_InsertItem($hListView, "")         _GUICtrlListView_SetItemText($hListView, $i, $avArrayText[$i], -1)

It's as simple as doing this :P

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.

thanks!
How did you know that? -It's not in the helpFile either!?
Best, randall

#9 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,770 posts

Posted 22 December 2007 - 10:31 PM

@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()

#10 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 22 December 2007 - 11:21 PM

@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()

Hi,
Not sure, myself.
@Valik says the "bloat" problem is "fixed" in "3.2.11.0", so not sure where he stands now, and whether it needs be moved to "deBug.au3" or not...;
Standard Library bloat issue, Fixed 3.2.11.0
I also wanted to change "ArrayDisplay" back to msgbox which would display only column 1 of 2D array, and warn to use the other function for 2D, but he wasn't happy! - surprise.

[Incidentally, my "_ArrayDebugDisplay" also fixes this current issue, but changes back more to current _ArrayDisplay" in other matters, but Ultima does not like it.. _ArrayDebugDisplay.au3
1. It also fixes the issue of too many columns not displaying.
2. It allows 1D to be transposed to read across instead of down (ie retains current capability and compatability)
3. It accepts Ultima's changes for speeding up, and numbering how many items to display; otherwise.
4. it allows naming the column headers by piping the 'Title" parameter; eg used in _ArrayDisplay3D.au3" UDFs_ArrayDisplay3Df.au3

But @Ultima not keen, as believes it increases complexity inappropriately.]

Edited by randallc, 23 December 2007 - 12:03 PM.


#11 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 22 December 2007 - 11:35 PM

I never said it was fixed. Another developer put the "Fixed in 3.2.11.0" tag on that, which is partially true as Gary and myself have done a few things since the last release to reduce the bloat. It's by no means fixed and likely will never be to a state I'm happy with it but some major issues were addressed. As far as I know, _ArrayDisplay() and it's bloat are still in Array.au3.

I'm fine with JP's idea of putting it in Debug.au3 and renaming it _DebugArrayDisplay(). Just post a version of the function you're happy with and that's where it will end up. That's all that's holding back this from being "Fixed in 3.2.11.0".

#12 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,354 posts

Posted 23 December 2007 - 08:43 AM

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

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#13 GEOSoft

GEOSoft

    Sure I'm senile. What's your excuse?

  • MVPs
  • 10,573 posts

Posted 23 December 2007 - 08:53 AM

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

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.
GeorgeQuestion about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else."Old age and treachery will always overcome youth and skill!"

#14 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,354 posts

Posted 23 December 2007 - 09:42 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.

There are other solutions to avoid the addition of too much extra weight to your script due to this UDF.

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.
  :)


#15 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,770 posts

Posted 23 December 2007 - 10:35 AM

The move to another lib was motivated by the big inclusion due to GUIListview.au3. If we go back to a MsgBox approach it can stay here in Array.au3 without name changing.
If we want to keep the display as a listiew the suggestion was to move it in debug.au3 with or without renaming I don't really care. It was just for coherent naming.

#16 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 23 December 2007 - 03:10 PM

There are other solutions to avoid the addition of too much extra weight to your script due to this UDF.

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.

#17 GEOSoft

GEOSoft

    Sure I'm senile. What's your excuse?

  • MVPs
  • 10,573 posts

Posted 23 December 2007 - 05:32 PM

My point is that the function really is designed for debug purposes and it would be better (IMHO) to use
#include <Array.au3>
#include <Debug.au3>
for testing a script and then remove the debug.au3 line when you're finished with debugging.
When writing a script that is just to be used for debugging other scripts then, assuming there will be more debug functions, you would probably want to #include <debug.au3> and not necessarily array.au3 anyway. What if your script is not using any of the functions in array.au3 but you do have an array that you want to check?
As it is I already have _ArrayDisplay() in a debug.au3 file and I #include <Arrayx.au3> instead of <array.au3>
To me this is a work-around that makes sense.
GeorgeQuestion about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else."Old age and treachery will always overcome youth and skill!"

#18 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 23 December 2007 - 05:34 PM

Gary has re-written the function not to #include anything else. To me, that's an acceptable solution.

#19 GEOSoft

GEOSoft

    Sure I'm senile. What's your excuse?

  • MVPs
  • 10,573 posts

Posted 23 December 2007 - 05:45 PM

Gary has re-written the function not to #include anything else. To me, that's an acceptable solution.

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.
GeorgeQuestion about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else."Old age and treachery will always overcome youth and skill!"

#20 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

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.


Array.au3 won't include any other files.

SciTE for AutoItDirections for Submitting Standard UDFs

Don't argue with an idiot; people watching may not be able to tell the difference.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users