[Gambas-user] Call control from one module
craf
prog at ...2177...
Thu May 13 00:45:00 CEST 2010
-----Mensaje original-----
De: EA7DFH <ea7dfh at ...2382...>
Reply-to: mailing list for gambas users
<gambas-user at lists.sourceforge.net>
Para: mailing list for gambas users <gambas-user at lists.sourceforge.net>
Asunto: Re: [Gambas-user] Call control from one module
Fecha: Thu, 13 May 2010 00:29:20 +0200
El 13/05/10 00:08, Jussi Lahtinen escribió:
> Project properties --> Check: Form controls are public.
>
> Jussi
>
>
> On Thu, May 13, 2010 at 00:45, craf <prog at ...2177...> wrote:
>> Hi.
>>
>> I need to call a control that is located on the main form from a module,
>> for this I have dealt with the following code:
>>
>> 'in module
>>
>> public sub proc_add()
>>
>> Fmain.control.text= "Hello"
>>
>> end sub
>>
>> But this form of call control does not work.
>>
>> Regards
>>
>If you wont your controls to be public, use Properties instead.
>(I think it is not a good idea to make public controls)
>In your form:
>PROPERTY myText as String
>' then two functions will be created automagically:
>PRIVATE SUB myText_Write(value as String)
textarea.Text = value
>END
>PRIVATE FUNCTION myText_Read() as String
> RETURN textArea.Text
>END
>Then you could call your property from within a module or another class
>MyForm.myText = whatevertext
>'or
>whatsmytext = MyForm.myText
>Hope this helps
>Jesus
Thanks Jesus!.
I had no idea of this utility, would comment on the forum.
Regards
------------------------------------------------------------------------------
_______________________________________________
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