[Gambas-user] Control groups

Grahame White grahame at ...457...
Mon May 24 00:12:35 CEST 2004


I've been playing with control groups created at runtime a bit but I'm not 
sure how to reference the created controls from another sub as the array 
of controls is declared using DIM within the startup routine.

Currently I have something like this

fmain.class

public sub form_open()

	dim mygroup[100] as new picturebox
	dim i as byte

	for i = 1 to 100
		mygroup[i] = new picturebox(me) as "mypics"
	next

	' Some more code to arrange the picboxes into a grid

end

Which works fine. However when I try to make a separate helper sub to 
manipulate the grid I'm not sure how to refer to the created pictureboxes.

An example of a simple sub is

public sub hide_picbox(index as byte)

	mygroup[index].visible = false

end

Obviously the above doesn't work but the intention is there and is what 
I've been trying to work out.

I tried declaring mygroup so that it was within scope of the entire file 
but that ended up messy (that is I ended up making it messy :))

Grahame

PS Contry to the evidence I am learning :)




More information about the User mailing list