[Gambas-user] Control groups

Fabien Bodard abidoo.too at ...11...
Tue May 25 19:39:31 CEST 2004


' Gambas class file
PUBLIC Board AS NEW Object[]

PUBLIC SUB Form_Open()
  
  DIM i AS Byte
  DIM j AS Byte

  Board.Resize (100)

  ' Create master geometry (10 x 10 grid)
  FOR i = 0 TO 9
    FOR j = 0 TO 9
      WAIT
      board[(i * 10) + j] = NEW PictureBox(ME) AS "GameBoard"
      board[(i * 10) + j].Border = 1
      board[(i * 10) + j].height = 48
      board[(i * 10) + j].width = 48
      board[(i * 10) + j].x = 8 + (48 * j)
      board[(i * 10) + j].y = 8 + (48 * i)
    NEXT
  NEXT

  ' Create board layouts
  MBoards.make_boards()
  MBoards.fill_boards()

  ' select a board to play on
  i = CInt(Rnd(0, Global.boarddesign.Count))

  ' Display the board layout
  FOR j = 0 TO 9
    set_row(Global.boarddesign[i].row[j], 1)
  NEXT

END

Hem this is the correction.

Before you use a local variable... It is just available in the form_open 
sub...
Here you need a global variable, but we can't use static array here.

So i've created a class dynamic array by :

public Board as New Object[]


After in the sub i've resized it by :

Board.Resize(100)

That's all Folks

Regards,

Fabien Bodard





More information about the User mailing list