[Gambas-devel] Gambas Question

Scott, Vince Vince.Scott at ...440...
Wed Mar 29 23:02:42 CEST 2006


Excellent information. I have used the Group to detect selection. What I am looking for is the use of the Object[]. The other options are a great addition as well. 

Using Gambas and loving it!

Vince


-----Original Message-----
From: gambas-devel-admin at lists.sourceforge.net on behalf of Benoit Minisini
Sent: Wed 3/29/2006 2:06 PM
To: gambas-devel at lists.sourceforge.net
Subject: Re: [Gambas-devel] Gambas Question
 
On Wednesday 29 March 2006 20:02, Scott, Vince wrote:
> In VB I could use Control arrays which made it easy to loop through the
> controls setting or clearing values. VB.net has done away with them,
> RealBasic doesn't use them and Gambas doesn't support them either. I find
> this odd as I found control array to be an awesome part of VB and used them
> all the time. Is there some underlying reason they are not being used??
>
> In Gambas is there away to cycle through a group of controls??
>
> For example in VB I could do this with a control:
>
>    For X = 0 to Count
>
>        txtMyTextBox(X).Text = X
>
>    Next
>
> Is this the only choice I have now:??
>
>    txtMyTextBox1.Text = 0
>    txtMyTextBox2.Text = 1
>    txtMyTextBox3.Text = 2
>    ...
>
>
> Thanks,
> Vince
>

You have many solutions in Gambas. It depends on what you need exactly:

1) If you need to manage the events of many controls with the same event 
handlers, use the control '(Group)' property in the IDE, or give the same 
event name to all your controls if you create them by hand.

2) You can put all the controls you need in an Object[] array. This way the VB 
control arrays come back.

3) If all your controls are in the same container, you can enumerate the 
Children property of this container.

4) You can use the Tag property. In Gambas, the Tag can be what you want, not 
just a string.

5) You can use inheritance and/or composition with the native control classes.

I can't tell you precisely, as I don't know what you do exactly.

Regards,

-- 
Benoit Minisini



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Gambas-devel mailing list
Gambas-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-devel



This communication is confidential and may be legally privileged.  If you are not the intended recipient, (i) please do not read or disclose to others, (ii) please notify the sender by reply mail, and (iii) please delete this communication from your system.  Failure to follow this process may be unlawful.  Thank you for your cooperation.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3887 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20060329/26938e1f/attachment.bin>


More information about the Devel mailing list