[Gambas-user] Modules cant raise events :-(

bbb888 bbruen at ...2308...
Mon Jan 11 04:25:16 CET 2010


Hi Benoit,


Benoît Minisini wrote:
> 
> If CurrentUser, CurrentProject and CurrentSystem are the objects that
> change, 
> then they should raise the events, not the module where they are declared. 
> Shouldn't they? An event is the way an object tells the world it has
> changed.
> 
> If you can't, then there is something not clear in your design.
> 
Actually, it was something unclear in my explanation.  Its the whole
instance that gets changed, for example, FReconnect allows the user to
change the CurrentProject.  So before it exits, we have

<code>env.CurrentProject = selectedProject</code>

where selectedProject is a Project instance and env has a Property
CurrentProject and

<code>PRIVATE SUB CurrentProject_Write(Value AS Project)
  $currentProject = Value
END</code>

In other words, I am overwriting the whole instance in "env" (or providing a
new replacement pointer, if you prefer). So, more specifically,
$currentProject doesn't "know" it's been "replaced".


Benoît Minisini wrote:
> Anyway, you can register your listeners in an object array in your module,
> and 
> call specific procedures of these object references when something change. 
> It's more like some sort of "bus".
> 
> I did that in the IDE. For example, when the project state changes (a new 
> project is loaded, the project enters debugging mode, and so on...), the
> same 
> procedure is called on all opened forms.
> 

This sounds like what I may be looking for! Could you provide a bit more of
a clue where to look as there is a lot of good stuff in the IDE project...
but there is quite a lot of code too!

Finally, just out of interest, why can't modules raise events?

Regards,
bruce
-- 
View this message in context: http://old.nabble.com/Modules-cant-raise-events-%3A-%28-tp27104759p27105479.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list