60000958 Call commands transparently using the command-line

Article 60000958
Type Wish
Product Engine
Version 6016
Date Added 9/14/2009 12:00:00 AM
Fixed (9/15/2009 12:00:00 AM)
Submitted by Marcelo Hosan

Summary

Can I call commands transparently using the command-line ? For example, while I am using cmdLine and drawing some lines, can I call the cmdCircle, by posting circle in the command-line, draw the circle and then "resume" cmdLine ?

Solution

Supported in version 6017
A new event ActionParse was added in vdDocument object which is fired before VectorDraw parse the user text.
Example in C# with vdFramedControl in a Form:

private void Form1_Load(object sender, EventArgs e)
{
   vdFramedControl.BaseCOntrol.ActiveDocument.ActionParse += new vdDocument.ActionParseEventHandler(doc_ActionParse);
}
void doc_ActionParse(object sender, string actionName, string parseString, ref bool cancel)
{
   //When the user type a string that starts with ' then try to parse as a command that is defined in commands.txt
   if (parseString.StartsWith("'"))
   {
       vdFramedControl.CommandLine.ExecuteCommand(parseString.TrimStart(new char[] { '\'' }));
       cancel = true;
   }
}

Send comments on this topic.