Ok, here is what I came up with. It doesn't do autocomplete, but it is a
start.

  <binding>
    <keyPressed code="ESCAPE" />
    <charTyped char="K" />
    <command name="setClass"/>
  </binding>

   <command name="setClass">
     <macro>
       <sequence>
         <command name="prompt"
                  parameter="Question class"/>
         <command name="putAttribute"
                  parameter="[implicitElement] class %_"/>
       </sequence>
     </macro>
   </command>

I didn't see why I'd need to use the "pass" construct, but maybe that's
for more complex macros that can fail in the middle?

Hussein Shafie wrote:
> Cay Horstmann wrote:
>> I'll have to look at the macro language a bit more.
>>
>> Here is something else that I'd like to have automated. I often need to
>> set the class of an element (for CSS styling). It is a bit tedious to
>> type Ctrl+E cl Down Enter (type name) Enter. It would be really nifty if
>> I could hit, say, Esc K, and get a popup like with the Esc C "insert
>> character". I'd like to pre-populate it with my favorite choices so I
>> get autocomplete. Can I do that?
> 
> A trivial 3-line macro (I can write it for you if you insist) can do that:
> 
> * see the pass construct
> (http://www.xmlmind.com/xmleditor/_distrib/doc/commands/macro_reference.html)
> 
> 
> * see command prompt
> (http://www.xmlmind.com/xmleditor/_distrib/doc/commands/prompt.html),
> 
> * see command pick
> (http://www.xmlmind.com/xmleditor/_distrib/doc/commands/pick.html)
> 
> * see command putAttribute
> (http://www.xmlmind.com/xmleditor/_distrib/doc/commands/putAttribute.html).
> 
> The problem is that command prompt requires you to type something and
> that command pick requires you to choose something from a fixed list.
> That is, autocomplete is not supported by these two commands.
> 


-- 

Cay S. Horstmann | http://horstmann.com | mailto:cay at horstmann.com


Reply via email to