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?


-Robert















On Thu, Nov 6, 2008 at 12:36 PM, Doriano Blengino <
[EMAIL PROTECTED]> wrote:

> Rob ha scritto:
> > On Thursday 06 November 2008 13:37, Doriano Blengino wrote:
> >
> >> i.e., LAST is a reference to the object that raised the event, and you
> >> can compare it to anything you like (probably widgets).
> >>
> >
> > Yes, that should work, but with limitations.  You would have to hardcode
> > the name of the control you wish to compare against at compile time.
> > Gambas lacks enough introspection at present to obtain a reference to an
> > object using its symbol name at run time.  (As far as I know, the same is
> > true of VB.)
> >
> Gambas does not lack introspection. You can compare LAST.name to a
> string, or LAST to a variable (an instance variable), or even look at
> the type of the object (object.Type(LAST)). The symbol name is a
> reference to the object,
> Mainly, my thought was directed to groups of widgets created at design
> time, where the name (symbol) of the widget/control *is* a reference to
> the object.
>
> >> The tag system is another way - sometimes tags are better, sometimes
> >> control/widget reference is.
> >>
> >
> > Agreed.  This will be easier if you have "OK" and "Cancel" buttons across
> > the bottom of the screen and want to tell which one got pressed, but if
> > you have an array of 64 buttons (or text boxes, like one of my clients)
> it
> > might be time to start assigning tags at control creation.
> >
> If you have a true array, then LAST = btns[0] should work. If you don't
> have an array (ie: for i=0 to 10 bnt = new Button....), then you don't
> have any reference to the objects you created, so clearly you can't
> compare to a reference you don't have...
> But note that you don't have to use Tag - you could use Name, Left, or
> whatever differentiates these controls each other. Of course, Tag is
> devoted to such things.
>
> Regards,
> Doriano
>
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to