and,why i can't use custom type variable in function block?
such as:
Code: Select all
type RECT
field x
field y
field width
field height
end type
theRect.RECT = new(RECT)
function DoSomething()
theRect\x = 10
end function
Code: Select all
type RECT
field x
field y
field width
field height
end type
theRect.RECT = new(RECT)
function DoSomething()
theRect\x = 10
end function
Code: Select all
type position
field x
field y
end type
type rect
field position
field width
field height
end type
Code: Select all
Global theRect.RECT = New(RECT)
Code: Select all
'Type declarations
Type POSITION
Field x
Field y
EndType
Type RECT
Field position
Field width
Field height
EndType
'Create a new rectangle and set its width and height
r.RECT = New(RECT)
r\width = 10
r\height = 10
'Create a new position instance
tmpPosition.POSITION = New(POSITION)
tmpPosition\x = 100
tmpPosition\y = 200
'Use ConvertToInteger() to store position in the rectangle
r\position = ConvertToInteger(tmpPosition)
'To access rectangle's position you need to use ConvertToType()
position.POSITION = ConvertToType(r\position)
Print position\x
Print position\y