R: [Gambas-user] How to change the name of an object on the f ly.. ...?
Pablo Vera
pvera at ...729...
Tue Mar 29 18:11:03 CEST 2005
Silveira Andre-WAS074 wrote:
> But I want then all in a specific displacement. how is it possible with dynamic allocation?
>
> Regards
_ _ _ _ _ _ _
I needed exactly what you described, so, using the IDE, I placed all the
objects where I needed them, then I wrote down all their X & Y (Left &
Top) attributes and finally, I removed all those controls.
I created several arrays to store the information and wrote the
following code:
--CODE----------------------------------------------------------------
PRIVATE Pocks AS Object[]
PUBLIC SUB Form_Open()
DIM X AS Integer[]
DIM Y AS Integer[]
DIM T AS String[]
DIM L AS Label
DIM I AS Integer
X = [111,168,225,299,354,410,464,410,355,299,226,169,111,54]
Y = [126,126,126,126,126,126,88,57,57,57,57,57,57,88]
T = ["1100","1201","1302","1403","1504","1605","1006","2107",
"2208","2309","2410","2511","2612","2013"]
Pocks = NEW Object[]
FOR I = 0 TO 13
L = NEW Label(ME) AS "lblPock"
Pocks.Add(L)
Pocks[I].W = 24
Pocks[I].H = 20
Pocks[I].X = X[I]
Pocks[I].Y = Y[I]
Pocks[I].Tag = T[I]
Pocks[I].Alignment = 4
Pocks[I].Background = &HCD7B11
Pocks[I].Visible = false
NEXT
END
---------------------------------------------------------------------
I also set the Tag property to identify them in the event handlers and
all of the controls respond to the "lblPock_???" events.
I hope this helps a little.
Saludos,
Pablo Vera
More information about the User
mailing list