XojoScript computed property

Hi,

Possible use computed property with XojoScript ?

Never see a example, if anybody have simple example.

Thanks,

I don’t think its possible. What you can do is a method with methodname(Assigns value as datatype)

Use it as Methodname = somevalue

Computed properties behave like Methods in a way.
The assigns keyword is very helpfull for this.

You are welcome.

I copied a computed property from a class. It looks like this:

Property myproperty As Integer
Get
  Return 1
End Get
Set
  value = 1
End Set

So probably you should use such code.

This syntax works, as confirmed by Joe R:

[code]Module Test
Dim p As Integer = 1
Property TestProp As Integer
Get
Return p
End Get
Set
p = value
End Set
End Property
End Module

Print(Str(Test.TestProp))[/code]

Computed Properties can be declared inside of modules and classes, but not at the top level of a script.