[Gambas-user] Send an Event...?

Fabien Bodard gambas.fr at ...626...
Sun Oct 30 11:45:41 CET 2011


2011/10/30 J_Mischk3 <admin at ...2701...>:
>
>
>
> Adam Ant wrote:
>>
>>
>>
>> Translated:  "The button control raises the event "Click" when the mouse
>> button is clicked on it. Can a textarea control observe and handle the
>> button's Click event?"
>> The literal answer is "no" because the native textarea control does not
>> observe events from some "unheard-of" button.  However, you can create
>> your own textarea based control  that will observe such events and can
>> contain code to handle them.
>>
>>
>
> Worng "translation". I wrote an example to understand to Fabien Bodard.
> Please look there
>
Well this what i do :

Public sub Button_Click()

  TextBox1OnButtonClick

End

Private Sub TextBox1OnButtonClick()

  TextBox1.Background=color.yellow

End



!-----------------------------------------------

But you can do that too


Public sub Button1_Click

  Analyse(Textbox1)

end


Private Sub Analyse(hText as TextBox)

  do someting on hText.Text


end


There are no needs to use events for something that just need functions call :/

events is just for an object that want to dialog with one of its
container. But for object in the same container, functions are used.

For exemple ... the needed event in your case is button_click then you
call a function that do something with the textbox or with a textbox
from this event.

-- 

Fabien Bodard




More information about the User mailing list