Not really sure what you're trying to do, and your code has a few problems. This should help:
Function cTextfield:tTxtBox( x%, y%, width%, height%, name$)
Local name:tTxtbox=New tTxtBox
name.x#=x%
name.y#=y%
Return name
End Function
Type tTxtBox
Field x:float
Field y:float
End Type