[Gambas-user] A good idea?

Tobias Boege taboege at ...626...
Sun Sep 21 00:57:55 CEST 2014


On Sun, 21 Sep 2014, B Bruen wrote:
> As some will know, we use a lot of third-party (i.e. developed by us) components and libraries in our projects.
>  Some of these are re-usable pop-up forms to provide common features across our gui apps. Things like  "AboutMe" and "SysInfos" forms that we need to place in all our client applications.
> 
> Each of these requires that we include the component in the project properties, create a menu item in the relevant form and an event handler for that menu item.  All these handlers essentially do is create an instance of the pop-up and ShowModal it.
> 
> The other day I had an idea.  I created a virtual control "wrapper" class that takes care of the above by itself. All the coder need do is to place the virtual control on the relevant form in form design mode.
> 
> Anyway, this seems to work!  I cant see any problems and I am now looking at more complex uses of this approach.  Perhaps it might be a way to implement the IDE add-ins mentioned recently?
> 
> Here is a project that mocks up this approach in that it is totally self contained (i.e. doesn't use components or libraries). If you would take a look you'll see that the main form, i.e. the "client", has no code at all for managing the pop-up (but does have a handler for an event raised by the pop-up).
> 
> What do you think?
> 

Veeeery nice idea! It looks a bit like an hack, though, because it's not
obvious (from the IDE form editor or otherwise) what the virtual control
does. I like it anyway.

I think you could even have a "MenuMaker" class which is your VControl.class
minus the menu-specific things. You would derive "HelpMaker" from that class
which provides the necessary names, like "mnuHelp", etc. and a real MakeMenu
method (or event handler?).

For the others: there is an error "Component not found: genutil". You can
either fix this yourselves or apply the attached patch. It seemed to be safe
to just remove that component (?).

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: virtctls-0.0.5~virtctls-0.0.5.patch
Type: text/x-diff
Size: 429 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20140921/15abcff4/attachment.patch>


More information about the User mailing list