[Gambas-user] calling back to the caller

Doriano Blengino doriano.blengino at ...1909...
Fri Mar 19 07:18:18 CET 2010


Charlie Reinl ha scritto:
>
>>> my project (from now on called 'the program')
>>> use a in gambas2 written component (from now on called 'the
>>> component' [which is  by it's own, also a executable]).
>>> 'the component' is embedded on a form of 'the program'.
>>> So the "parent" is known.
>>> What I want is calling a Sub/Function, declared in 'the program', out
>>> from 'the component' ..... calling back to the caller.
>>>
>>> Better now ?
>>>
>>> Charlie
>>>
>>>       
>
> Salut Doriano & Fabian,
>
> I attached a (no, two) gambas2 project(s), which does now, all I
> expected to find when I started for that.
>
> Finally what I need is a user "named" Interface which comes back to the
> caller which is the users project, who had called my component.
> First I planed that the component has to be embedded (for the parents
> stuff) but now I found out, I can call back, if the called, knows the
> Name of the caller (and the method to call).
>
> That gives me and the user a lot of freedom. 
>
> The reason, why EVAL work with intern method only if you give the name
> of the owner (ME.Name) is an extra job for Benoît! 
>   
It seems to me that events should be the way to go. You want to notify 
the main program (notify, or pass some data) from a component: why don't 
use events? They were invented just for that. You can use a single 
event, or you can use three for red, green and blue.
Arguments to the event can be precise, if the logic dictates they are 
precise; otherwise you can use a string, and let the main program use 
tests or "eval" to carry out more sophisticated things.

I didn't run your project, but it seemed to me that things break if you 
put your component in different position of the hierarchy (ie: directly 
on a form, or embedded into a frame). Anyway, you solved... even if I 
didn't fully understand what is the aim.

Cheers,

-- 
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."





More information about the User mailing list