Plugins menu (was: Re: Speaking of IDE Updates)

Richard Gaskin ambassador at fourthworld.com
Fri Jan 2 16:34:36 EST 2004


Wilhelm Sanke wrote:

>> Both Richard's and my script update the text of the menu button at
>> once also during a "session" when  something is added to or removed
>> from the "plugins" folder. Our scripts are much shorter than the
>> corresponding Rev scripts - and especially Richard's solution is an
>> excellent example of  "clean and lean" programming.
> 
> While this remains true in essence, I see from a second look at
> Richard's new "mctools" stack that he, too, distributes the necessary
> scripts across three objects:
> 
> - the function Pluginsfolder has been added to the script of the
> invisible button "newobj"

Both the menu group and the menu button need to get the name of the Plugins
folder.  Being somewhat obsessive about centralizing code, using a common
function stored farther down the message path seemed useful.

> - the updating of the text of the menu button "Plugins" takes place in
> the modified script of group "Metacard Menu Bar" of the Menubar

On Mac only the menu group gets the mouseDown message.

In the menu group Dr. Raney already had a mousedown handler, which calls a
series of setup handlers, one for each menu that needs updating.  In adding
your Plugins update code to that script I followed his form and broke it out
into a call to a handler named setupplugins.
 
> - finally the lean script of button "Plugins" itself
> 
> Considering the summative length of the scripts, my script - exclusively
> contained in button "Plugins" - seems to be the leanest, but probably
> there are reasons for Richard to choose a different approach -
> circumventing problems I do not see? Richard?

Lean and self-contained are useful goals.  If only the Mac would let us
handle mouseDown messages there the only other modification that was useful
was the "defensive programming" change which builds the path to the plugins
folder rather than assume the directory will remain its initial value
throughout the session (I rarely change it without setting it back, as your
scripts do, but it's conceivable that someone might so it seemed worth the
extra few lines to account for it).

This exercise reminds me of that old adage from Steven McConnell:

  To build a tool it need only be possible to use it correctly.
  But with a product it should be impossible to use it incorrectly.

:)

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Developer of WebMerge: Publish any database on any Web site
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com



More information about the metacard mailing list