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
diff -urNaX /tmp/gambas-patch-ignore a/.project b/.project
--- a/.project 2014-09-21 00:22:13.000000000 +0200
+++ b/.project 2014-09-21 00:46:55.000000000 +0200
@@ -4,11 +4,10 @@
Startup=FMain
Version=0.0.5
Component=gb.image
-Component=gb.desktop.x11
Component=gb.gui
-Component=gb.desktop
Component=gb.form
+Component=gb.desktop.x11
+Component=gb.desktop
Component=gb.form.stock
-Component=genutil
TabSize=2
Packager=1
------------------------------------------------------------------------------
Slashdot TV. Video for Nerds. Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user