Opened 4 years ago

Last modified 4 years ago

#3739 closed Feature Request

Scripting.dictionary Keys/Items array support for _ArrayDisplay — at Version 2

Reported by: Beege Owned by:
Milestone: 3.3.15.4 Component: Standard UDFs
Version: Severity: None
Keywords: _Arraydisplay scripting.dictionary Cc:

Description (last modified by mLipok)

I wanted to ask for this years ago but at the time _arraydisplay was stand alone function and I thought it was a bit much to ask to make it a sub function just to support this. I also couldn't see asking for _dictionarydisplay because where would it go? I see now that _arraydisplay has had an overhall and is using a shared sub function so this would be real easy to add by throwing the keys and items arrays together into a temp 2D array before calling shared function. Same idea could be done with maps as well.

#include <array.au3>

$oDi = ObjCreate('scripting.dictionary')
For $i = 0 to 10
        $oDi.Add('key' & $i,'item' & $i)
Next
ArrayDisplay($oDi)


Func ArrayDisplay(Const ByRef $aArray, $sTitle = Default, $sArrayRange = Default, $iFlags = Default, $vUser_Separator = Default, $sHeader = Default, $iMax_ColWidth = Default)
        #forceref $vUser_Separator

        If IsObj($aArray) And StringInStr(ObjName($aArray, 3), 'scripting.dictionary') Then

                Local $aTmp[$aArray.Count][2], $aK = $aArray.Keys, $aI = $aArray.Items
                For $i = 0 To $aArray.Count - 1
                        $aTmp[$i][0] = $aK[$i]
                        $aTmp[$i][1] = $aI[$i]
                Next

                If $sHeader = Default Then $sHeader = 'Keys|Items'
                If $sTitle = Default Then $sTitle = 'DictionaryDisplay'

                Local $iRet = __ArrayDisplay_Share($aTmp, $sTitle, $sArrayRange, $iFlags, Default, $sHeader, $iMax_ColWidth, 0, False)
        Else
                Local $iRet = __ArrayDisplay_Share($aArray, $sTitle, $sArrayRange, $iFlags, Default, $sHeader, $iMax_ColWidth, 0, False)
        EndIf
        Return SetError(@error, @extended, $iRet)
EndFunc   ;==>ArrayDisplay

Change History (2)

comment:1 Changed 4 years ago by Beege

Sorry the component should be Standard UDFs for this

comment:2 Changed 4 years ago by mLipok

  • Component changed from AutoIt to Standard UDFs
  • Description modified (diff)
Note: See TracTickets for help on using tickets.