Genii Weblog


Civility in critiquing the ideas of others is no vice. Rudeness in defending your own ideas is no virtue.


Thu 10 Feb 2005, 05:37 PM
In response to my search for simple API extensions, Tom Duff responded:
I don't know if this is what you had in mind, but here's my "wish"...

When I import a graphic image into a Notes document, I like to use a two-lined border with a weight of 4  and a drop shadow for 12 weight.  The "problem" is that the picture property box doesn't have a memory, so each new picture I load involves getting the picture property box, clicking on the second tab, selecting my double-edge border, selecting the drop shadow, and upping the border weight from 1 to 4.
  
What I'd love to do is have an @Function I could attach to a Smart Icon that allows me to feed in those parameters and set them when I have a picture object selected...
I made some comment about send keys, and Alan Bell was off and running with an extraordinary, if really unwise as he admits, script to do just this: Don't try this at home, silly stuff with sendkeys.

Kudos to Alan, but it still doesn't address Tom's need fully, because he wanted an @Function in a Smart Icon (although I think their called Tool Tips or something now, Tom).  So, I got to thinking.  How would I do this with the @Midas Formulas.  As I often do, I thought first of how I would do this with the Midas Rich Text LSX, as it seems a bit more intuitive still.  The logic, which depends on stuff in Version 3.50, so you can't try this at home yet, is:

Set rtchunk = rtitem.DefineChunk("Graphic 1")
Call rtchunk.SetTargetProperties("Graphic", "BorderEffects='Drop_Shadow' BorderThickness='4' BorderStyle='Double' BorderColor='Black' ")
Call rtitem.Save()

So, to do the same thing in @Midas Formulas just takes a bit of jiggering, and the result is:

@DbCommand("Midas":"NoCache""SetTargetProperties"""; @DocumentUniqueID; "Body":"Graphic 1""Graphic";  "BorderEffects='Drop_Shadow' BorderThickness='4' BorderStyle='Double'")

which will work in a Smart Icon or Tool Tip or whatever.  You might want to expand it a bit to say:

@Command(FileSave);
@DbCommand("Midas":"NoCache""SetTargetProperties"""; @DocumentUniqueID; "Body":"Graphic 1""Graphic";  "BorderEffects='Drop_Shadow' BorderThickness='4' BorderStyle='Double'");
@Command(EditDocument"0");

So, you have a choice of LotusScript using Windows API SendKeys courtesy of Alan, formula language courtesy of the @Midas Formulas, or LotusScript using Midas (see above) or even C++ using the Midas Rich Text C++ API, which would just be:

rtchunk_ = rtitem_->DefineChunk("Graphic 1");
sError = rtchunk_->SetTargetProperties("Graphic", "BorderEffects='Drop_Shadow' BorderThickness='4' BorderStyle='Double' BorderColor='Black' ");
if (sError == NOERROR) 
  rtitem_->Save();

You choose.  I still have to finish my samples for my conference, but this has at least given me some ideas.

Copyright © 2005 Genii Software Ltd.