[Gambas-user] GAMBAS rules! (And a couple of questions about listboxes and control "arrays")

Fabien Bodard gambas.fr at ...626...
Fri Jan 1 17:24:00 CET 2010


2010/1/1 Doriano Blengino <doriano.blengino at ...1909...>:
> Bill Richman ha scritto:
>> Hi.  Thanks for taking the time to explain all of that.  I actually had
>> most of the code figured out and working already, but you've filled in
>> some information about "why" it works that I wasn't sure about.  I had
>> the code creating the buttons, and the "button_click" sub with the
>> "LAST" value being stored.  I was having trouble getting the array
>> declared in a way that would make it available to the entire class and
>> still keep the compiler happy.  Mostly through trial-and-error, I
>> figured out that I could use:  PUBLIC aButtons AS Object[150] to
>> accomplish what I needed to.  I don't have the "NEW" clause in there;
>> I'm not sure if that will come back to bite me or not.  I have a few
>> things to clean up in the user interface and I think my project will be
>> ready for use.  I'll probably be back to bother you guys again, though.
>> :-)
>>
>> P.S.  - Happy New Year, everyone!
>>
> Thanks for the whishes, and Happy New Year to you and everybody in this
> list.
>
> About the declaration, if the compiler accepts "PUBLIC aButtons AS
> Object[150]" I think it will not byte you... but at this point it's me
> that gets confused :-)... so I go for some experiment, and find the
> following.
>
> The first way I suggested, "new object[]", is a growing list of objects.
> The notation you use is a static array;
no, a static array is defined like that :

Public aButton[150] as Object

This notation :
PUBLIC aButtons AS Object[150]

define a dynamic array but setup 150 entries

http://gambasdoc.org/help/lang/arraydecl?show

!!! Do not use static arrays as local variables. It works at the
moment, but may be removed in the future. !!!


i made some experiment, and
> found that there is no real differences between the two - your
> declaration is really a dynamic list containing already a number of
> elements. There is always something to learn...
>
> You insist on troubles having the array visible in the whole class, but
> it seems to me that there can be no troubles - when you declare
> variables in a class, there is no way to hide those variables from the
> class itself; you can only declare them PRIVATE to hide them from the
> outside. So, every declaration would get what you wanted.
>
> Anyway, it works - and this is good.
>
> Happy typing,
>
> --
> Doriano Blengino
>
> "Listen twice before you speak.
> This is why we have two ears, but only one mouth."
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list