[Gambas-user] Forms (dialogs) from within a module/class

Rolf-Werner Eilert eilert-sprachen at ...221...
Mon May 12 10:50:55 CEST 2014



Am 12.05.2014 10:21, schrieb B Bruen:
> On Mon, 12 May 2014 09:15:45 +0200
> Rolf-Werner Eilert <eilert-sprachen at ...221...> wrote:
>
>> Just a question which has been there for a long time, but difficult for
>> me to describe:
>>
>> When I have a module or class that needs some dialogs when running, do I
>> have to load these forms independently from the main program or is there
>> a way to "pack" them into the module or have them as childs of this
>> module/class in the treeview?
>>
>> Hope you got what I mean...
>>
>> Rolf
>>
> Regarding the second, "have them as childs ... in the treeview" :
> I am presuming that you are talking about the IDE project browser. The only way that a class/module will appear as a child node in the treeview is if it inherits from the higher node . BUT if you want to collect classes etc into groups then just create a "Directory" in the treeview and create or drag them there. The IDE code is structured that way.
>
> Regarding the first, I am not sure what you are after here? I think that if a class/module method requires a dialog form then the entire instanciation and showing of the form is most properly handled within that class/module rather than the main application form.
>
> It would be interesting to see some pseudocode that demonstrates your problem.
>
> hth
> Bruce
>
>

Thanks Bruce, the thing with the grouping is a good idea. Didn't even 
know it exists.

Well, I don't know if this has really got to do with the code. To me it 
seems to be rather a problem of organizing the forms. Let me describe it 
this way: When I want some kind of specialised dialog which must be 
called during the module's run, I need to create a form. So I add a new 
form to the project browser and give it some name (dlgAskTheUser.frm for 
instance). Then I use the IDE to design its contents and add some code. 
When it is needed in the module, it is called from there.

But when I want to re-use the module in another program, I will have to 
copy the form as well. So I thought, it might be nice to have some means 
of incorporating this form into the module so it is not a dialog for 
everyone in the project but a specialised form for that module only that 
comes with it automatically when copied from one project to another.

I just tried the group/directory thing and it seems to be what I want. 
Would you agree?

Rolf




More information about the User mailing list