[Gambas-user] Forward events from constructor

Benoît Minisini gambas at ...1...
Sun Oct 4 18:32:22 CEST 2015


Le 04/10/2015 18:29, Tobias Boege a écrit :
> On Sat, 03 Oct 2015, Beno??t Minisini wrote:
>>> Is there a limitation, about raising events from constructors, I don't know
>>> of? Also note how, in the demonstration project, I can very well initiate
>>> the validation procedure just after the constructor finished.
>>>
>>
>> The logic behind that behaviour is that an object whose constructor is
>> not finished should not be able to raise or catch events.
>>
>> Said differently, an object must be ready to deal with events.
>>
>
> Uff, I didn't expect the answer to make this much sense...
>

It's not technically necessary to do that, but it avoids a lot of 
possible annoying bugs in your code.

-- 
Benoît Minisini




More information about the User mailing list