[Gambas-user] Not sure on declaring user-defined datatype arrays
Grahame White
grahame at ...307...
Fri Apr 30 22:27:00 CEST 2004
On Friday 30 April 2004 21:04, ron wrote:
> 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
The comments you added were very helpful, I couldn't quite grasp the
concept before but I makes a lot more sense to me now. I wouldn't say I
completely understand but once I've coded a few things with it, and
debugged them a few times I should ;)
The final example was also very helpful, to be honest I found that to be
more helpful than the example in the how do i... section of the help
files. Very newbie friendly :)
Thanks again
Grahame
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: Oracle 10g
> Get certified on the hottest thing ever to hit the market... Oracle 10g.
> Take an Oracle 10g class now, and we'll give you the exam FREE.
> http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list