Script Editor
Richard Gaskin
ambassador at fourthworld.com
Fri May 16 17:59:00 EDT 2003
Other tidbits on script editing:
I commonly use brief comments to indicate a variety of things about the
code:
--! means "not finished, needs review before shipping"
--? means "questionable algorithm, may need revision, test carefully"
--|somestring means something worth noting before shipping, but
not critical; often used as a label
# is reserved for new comments added to converted code,
to disinguish from legacy comments which use "--"
While these are useful when skimming code, they become very useful with a
stack-wide search, usually done in late stages of development to make sure
I've battened down all the hatches.
Tip for using a custom script editor
------------------------------------
I've modified a copy of the MC 2.5 editor to include a few niceties I
prefer, and to govern its use I found this setup helpful:
I put my modified script editor into my main custom tools palette, and added
a checkbox to activate it. The checkbox script reads:
on mouseUp
if the hilite of me is true then start using "fwScriptEditor"
else stop using "fwScriptEditor"
end mouseUp
The editor stack ("fwScriptEditor") has this in it:
on libraryStack
insert script of btn "fwScriptEditorFrontScript" \
of stack "fwScriptEditor" into front
end libraryStack
on releaseStack
remove script of btn "fwScriptEditorFrontScript"
of stack "fwScriptEditor" from front
end releaseStack
This inserts the script of a button hidden on the stack solely to hold the
frontscript. Because I was lazy and modified MC's editor rather than wrote
my own from scratch, that frontscript is little more than a slightly
modified versio of the frontscrpt MC uses to trap the editScript message.
That's the only critical part: as long as your frontscript loads after
whatever frontscript is inserted by the host IDE (Rev or MC), you'll catch
the editScript message first and can handle it as you like.
Which takes us back to the checkbox: while you're developing your editor
unless you are a total god you'll likely have errors at first. Without a
checkbox to trigger the removal of the frontscript you wont be able to let
the host IDE use its working script editor to fix the issue. (Like pulling
yourself up by your own bootstaps only to have the shoelace keep breaking
<g>)
I could just as easily have had the checkbox govern the frontscript
insertion without the extra step of librarying a stack to do it, but I love
the simplicity of "start using" and it lets me invoke my editor as simply as
possible, leaving it to the editor's stack script itself to handle any
specifics of its implementation.
--
Richard Gaskin
Fourth World Media Corporation
Developer of WebMerge 2.2: Publish any database on any site
___________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
Tel: 323-225-3717 AIM: FourthWorldInc
More information about the metacard
mailing list