[Gambas-user] Not sure on declaring user-defined datatype arrays
ron
ronstk at ...239...
Fri Apr 30 22:04:31 CEST 2004
To be more exact.
> > PUBLIC SUB Form_Show()
> >
> > tmp_object AS NEW Thingy
dim tmp_object as thingy
Here you declare tmp_object should handle the defenition of thingy
> > DIM i AS Byte
> >
> > ' Create two elements in the Pile array
> > FOR i = 1 TO 2
tmp_object = NEW thingy
Here you create the tmp_object with as defenition the thingy class
as a new object to do something with.
> > Global.Pile.Add(Thingy)
Add a definition to the array or do you want to add a object with the
defenition to the array?
Global.Pile.Add(tmp_object)
> > NEXT
> >
> > WITH Global.Pile[0]
> > .Name = "Square"
> > .Height = 10
> > .Width = 10
> > END WITH
> >
> > WITH Global.Pile[1]
> > .Name = "Rectangle"
> > .Height = 20
> > .Width = 10
> > END WITH
> >
> > END
Just for the fun:
public sub buildstreet()
dim new_home as house ' or flat
dim i as integer
for i =1 to buildings.in.the.street
new_home = new house ' or flat
new_home.street =" avenue gambas"
new_home.housenumber = i
street.add(new_home)
next
Hope this will give better info. ;=)
Ron
More information about the User
mailing list