[Gambas-user] Accessing elements of dynamic control arrays. Not possible outside of creating function? Help please ^_^
Robert Moss
the.at.robert at ...626...
Fri Nov 7 11:47:48 CET 2008
OK, //CODE EXAMPLE AT END OF MSG
I have a subclass of Socket, Which is a socket, but contains some extra
data, so that in the event handler, I have more than just the TAG property
to work with.
It seems that I cannot have a dynamically sized array.
When i try putting:
PUBLIC mySW[] as SWSocket
At the top of the form class, it says "Arrays are forbidden here"
And if I declare it like:
Sub Form_Open ()
DIM mySW[] as SWSocket
it says syntax error.
It's requiring me to set an array size, which isn't good, and on top of
that, I cannot access the socket outside of that function (and i believe the
sockets are destroyed once the open sub ends)
I'd like a button on the form that works like this
PUBLIC SUB btnAdd_Click()
mySw[iNextSw] = new SWSocket;
mySw[iNextSw].DoSomeMethod()
INC iNextSw
END
'With a timer that does:
PUBLIC SUB Timer_Tick() 'or whatever it is, not important
DIM X as Integer
FOR X = 0 TO (iNextSw - 1)
mySw[X].SendData
NEXT
END
How can I do this?
More information about the User
mailing list