Jump to content
Sign in to follow this  
Xandy

AutoItObject array property

Recommended Posts

Xandy

I'm trying to contain these arrays as properties within the object.

I'm not sure how to create an array property with AutoItObject.

and I have no idea how to access the elements of the array property.

This example isn't meant to run.

func tilewindowobject(byref $sourcetile, $sourcetiles, $w, $h, byref $_tilepagerect, byref $_tilepagerects, byref $tileperpage, $iStartup = False)
    local $oObj = _AutoItObject_Create()
    _AutoItObject_AddProperty($oObj, "win", $ELSCOPE_Public, windowobject())
    _AutoItObject_AddProperty($oObj, "page", $ELSCOPE_Public, 0)
    _AutoItObject_AddProperty($oObj, "update", $ELSCOPE_Public, 0)
    _AutoItObject_AddProperty($oObj, "tiles", $ELSCOPE_Public, $sourcetiles)
    _AutoItObject_AddProperty($oObj, "tilecur", $ELSCOPE_Public, 0)
    ; =====================================================================; create array property ?
    local $arect[$tileperpagemax];200 random size tiles per page
    $arect[0]= rectobject(100, 200, 300, 400); some values x, y, w, h
    for $i= 1 to $tileperpagemax-1
        $arect[$i]= _AutoItObject_Create($arect[0])
    next
    _AutoItObject_AddProperty($oObj, "tilerect", $ELSCOPE_Public, $arect)
    ; =====================================================================
    _AutoItObject_AddMethod($oObj, "make", "tilewindowo_make")
    _AutoItObject_AddMethod($oObj, "drawtiles", "tilewindowo_drawtiles")
    _AutoItObject_AddMethod($oObj, "listen", "tilewindowo_listen")
    _AutoItObject_AddMethod($oObj, "calctiles", "tilewindowo_calctiles")
    $oObj.make($sourcetile, $w, $h, $_tilepagerect, $_tilepagerects, $tileperpage)
    if $iStartup then $oObj.Startup
return $oObj
EndFunc;tilewindowobject()

$tilewindow= $tilewindowobject($tile, $tiles, 200, 200, $tilepagerect, $tilepagerects, $tileperpage);No error
consolewrite("test element member "&$oObj.tilerect[0].x);syntax error

Can anyone show me the syntax for AutoItObject array properties?

Just a array property create phase and query or assignment

Edited by Xandy

Share this post


Link to post
Share on other sites
trancexx

Newer versions of AutoIt allow for syntax like that. Eh, I'm really sorry that I can't do anything to make it available to you.

Try using temporary variable to save the object from the array to and dot-access that.

  • Like 1

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×