[Gambas-user] RE: Gambas-user digest, Vol 1 #1053 - 4 msgs

P@...727...@N panpan at ...726...
Fri Dec 17 07:37:34 CET 2004


Thank you Pablo,
I have been doing that all this time.

Since I want to use the tag property for another purpose,
now I'm looking another better or proper approach, if there are any.
I like my program to know the type of each control in the form using the
"type" of the control.

I tried this :
----------------------------------------
Dim Kontrol as Control

For Each Kontrol in fmOne.Children
  Message(Str(TypeOf(Kontrol)))
Next
----------------------------------------
It always return 16 whether the control is button, textbox, or else.
I guess 16 is TypeOf "Control" itself eh?

Anybody has another way? Please?
Thx anyone

salam
-iggy

> Date: Thu, 16 Dec 2004 08:08:46 -0600
> From: Pablo Vera <pvera at ...729...>
> Organization: VERCAN Consultores, SA de CV
> To:  gambas-user at lists.sourceforge.net
> Subject: Re: [Gambas-user] need help : form control (another one)
> Reply-To: gambas-user at lists.sourceforge.net
>
> You could add a PUBLIC FUNCTION to fmOne that returns the number of
> textboxes.  For this to work, you need to use the TAG property of each
> control to identify it.  Every time you create a Textbox, you need to
> assign the string "textbox" to its TAG property.
>
>
> In fmOne:
>
> PUBLIC FUNCTION CountTextboxes() AS Integer
> DIM ctl AS Control
> DIM Count AS Integer
>   Count = 0
>   FOR EACH ctl IN ME.Children
>     IF ctl.TAG = "textbox" THEN Count = Count + 1
>   NEXT
>   RETURN Count
> END
>
>
> In fmMain:
>
> PUBLIC SUB btnGo_Click()
>   txtCount.Text = fmOne.CountTextboxes
> END
>
>
> I hope this helps.
>
> Saludos,
> Pablo Vera
>
>
>
> Iggy Budiman wrote:
>
> >Hi all,
> >I have another question about form controls.
> >
> >2 forms (fmMain and fmOne)
> >fmMain has 1 textbox (txtCount) and 1 button (btnGo)
> >fmOne has many controls, several labels, buttons and textboxes.
> >
> >What I want to do is :
> >When I click btnGo @fmMain, txtCount @fmMain display the number
> of textboxes
> >at fmOne
> >
> >Thanks b4
> >
> >little info for Benoit : In my country, Gambas is local
> vegetable (cucumber
> >family)
> >When I talk to people about your Gambas, everybody always
> listened with big
> >smile.






More information about the User mailing list