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

Rolf-Werner Eilert eilert-sprachen at ...221...
Wed Dec 17 11:29:36 CET 2014


Hi Tobias,

After some time, I had the chance to look at this thing again:

Am 19.11.2014 16:37, schrieb Tobias Boege:
> 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
>


My question is, when I have more than a few parameters to state, how can 
I achieve that?

Now it is

Return ["name": txtName.Text, "password": txtPassword.Text]

but when I have 200 or more things to pass? Or is the collection thing 
too slowly for such a number of items?

Rolf




More information about the User mailing list