[Gambas-user] Arrays of controls
Benoît Minisini
gambas at ...1...
Sun Aug 28 10:39:55 CEST 2011
> Hi out there,
>
> I do not check this at all:
>
> Public Sub Page_First_Init()
> Dim hPictureBox As PictureBox
> Dim I As Integer
> For i = 0 To 9
> hPictureBox = New PictureBox(Me) As "PBX"
> hPictureBox.Tag = i
> Next
> End
>
> Seems to work. But how do I call one of this bitmaps, for example make the
> first visible, and resize it? I have a complete crash with the FOR EACH, do
> not understand it at all, what to define where.
>
> I will be really grateful for some detailled help here, because it levels
> up the software massive, when I get this jump. I have looked a lot around,
> but for the point I don't understand - nothing.
>
> In this case PBX_Click() will help me nothing, because all PictureBoxes
> have to be invisible at start.
>
> Thanks in advance and regards,
> Dag-Jarle johansen
The solution is in the mail subject.
If you use Gambas 3, you can do that:
' ---------
Private $aPictureBox As PictureBox[]
Public Sub Page_First_Init()
Dim hPictureBox As PictureBox
Dim I As Integer
$aPictureBox = New PictureBox[10]
For i = 0 To 9
hPictureBox = New PictureBox(Me) As "PBX"
hPictureBox.Tag = i
$aPictureBox[i] = hPictureBox
Next
End
' ---------
Then you will access the i-th PictureBox somewhere else with $aPictureBox[i].
Regards,
--
Benoît Minisini
More information about the User
mailing list