On Sun, 3 Jul 2016 18:20:15 +1000
Shane <buster6se...@gmail.com> wrote:

> I'm trying create a array of myClass but when i create it i have an 
> array of null values
> 
> i have my Rect.class
> 
> Public x As Integer
> Public y As Integer
> Public width As Integer
> Public height As Integer
> 
> 
> then my Block.class
> 
> Public Screenpos As New Rect
> Public Imagepos As New Rect
> Public num_hits As Integer
> 
> and then in the main module i do
> 
> Public Blocks As New Block[MAX_BLOCKS]
> 
> and i get an array with Max_BLOCKS indexes on null values
> 
> what am i doing wrong
> 
> thanks Shane
> 
> 
> 
Well at first glance I'd tend to say - nothing!  
Declaration of the array in your main module is doing exactly what it should.  
Creating an empty array (presumably of length MAX_BLOCKS).
If you were expecting that you would have an array of length MAX_BLOCKS 
completely populated with some form of Block objects then this is not what you 
are going to get.

Try (in the Main module)
Public Blocks As New Block[MAX_BLOCKS]

Public Sub Main()

Dim idx as integer
Dim hBlock as new Block

For idx = 0 to MAX_BLOCKS-1
  Blocks[idx] = hBlock
Next

etc


Or have I misunderstood?

hth
Bruce

-- 
B Bruen <adamn...@gnail.com (sort of)>

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to