[Gambas-user] How do I pass a user parameter from a dialog form?

Tobias Boege taboege at ...626...
Wed Nov 19 16:37:40 CET 2014


On Wed, 19 Nov 2014, Rolf-Werner Eilert wrote:
> > This is a standard task and therefore a "template solution" evolved in the
> > Gambas sources. Attached is a project which shows how to do it cleanly, no
> > public variables and no auxiliary classes needed.
> >
> > If you have a problem with the project and comments being German, I will
> > translate it for you...
> >
> > Regards,
> > Tobi
> >
> >
> 
> 
> Thanks for that example. Never realised there would be this way to do 
> it. It does indeed save a lot of trouble with values from dialogs. On 
> the other hand, it means changing the form calls I'm used to from a 
> simple "formxyz.ShowModal" to "DIM hForm As New formxyz" "aCollection = 
> hForm(...)".
> 
> Let me ask two things I stumbled over when studying the code:
> 
> Where would I find this "call" thing in the documentation? F2 doesn't 
> react to event calls, and I cannot find it under the event descriptions 
> (like Event Management etc.).
> 

_call is a special method that allows you to use an object like a function.
It is documented in the "Special methods" section[0].

However, it is not mandatory here. In Gambas sources you mostly see a
function named Run() instead. I just like the _call() syntax better.

> Why is a SUB used with a Return value? Wouldn't it be more up to 
> standards to use a FUNCTION instead? (As far as I understand, a SUB is a 
> function without a return value, one that would be of type "void" under C.)
> 

Definitely! Usually I do that, but sometimes signatures change when I
develop the code further. I must have overseen that spot. Anyway, in
Gambas Sub, Procedure and Function are mutually interchangeable.

Regards,
Tobi

[0] http://gambaswiki.org/wiki/cat/special

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list