Re: Define Record Variables, Like Pascal

"valery_vi" <[email protected]>
Newsgroups gmane.comp.windows.autoit.user
Message-ID <[email protected]>
Hi,

Last news about useful dots:

http://www.autoitscript.com/forum/index.php?
showtopic=19717&st=210&start=210

Both variants of the same:
(This one will be invalid in next beta!):

func AClass($One='', $Two='')
struct $AClass
char One[256]
char Two[256]
endstruct
$AClass.one = $One
$AClass.two = $Two
return $AClass
EndFunc

$MyClass = AClass('One',3)
MsgBox(0,'',$MyClass.one & ' ' & $MyClass.two)

$YourClass = AClass()
$YourClass.one = 2345.78
$YourClass.two = True
MsgBox(0,'',$YourClass.one & ' ' & $YourClass.two)

and this one (under debating):

func AClass($One='', $Two='')
local $AClassDef = 'char One[256];char Two[256]'
$AClass = DllStructCreate($AClassDef)
$AClass.One = $One
$AClass.Two = $Two
return $AClass
EndFunc

$MyClass = AClass('One',3)
MsgBox(0,'',$MyClass.one & ' ' & $MyClass.two)

$YourClass = AClass()
$YourClass.one = 2345.78
$YourClass.two = True
MsgBox(0,'',$YourClass.one & ' ' & $YourClass.two)

will be harmful in the future. 

Valery


--- In [email protected], "valery_vi" <shehrer1@...> wrote:
>
> piccaso wrote about useful case of beta AutoIt3.2.3.0:
> http://www.autoitscript.com/forum/index.php?showtopic=42592
> "..
> Func CreatePerson()
>     Local Struct $vPerson
>         char Name[256]
>         Int age
>     EndStruct
>     Return $vPerson
> EndFunc
> 
> $vPiccaso = CreatePerson()
> $vPiccaso.Name = "Flo"
> $vPiccaso.age = 25
> 
> $vSomeOneElse = CreatePerson()
> $vSomeOneElse.Name = "Someoneelse"
> .."
> 
> Beta option
> Struct...EndStruct 
> Declare a variable with typed subelements
> 
> Other example:
> 
> func AClass($One='', $Two='')
>  struct $AClass
>   char One[256]
>   char Two[256]
>  endstruct
>  $AClass.one = $One
>  $AClass.two = $Two
>  return $AClass
> EndFunc
> 
> $MyClass = AClass('One',3)
> MsgBox(0,'',$MyClass.one & '  ' & $MyClass.two)
> 
> $YourClass = AClass()
> $YourClass.one = 2345.78
> $YourClass.two = True
> MsgBox(0,'',$YourClass.one & '  ' & $YourClass.two)
> 
> Valery
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.