Prod.: Engine, ver.: 6016, ID: 60000958, Wish : Call commands transparently using the command-line

Wish : Call commands transparently using the command-line

Article60000958
TypeWish
ProductEngine
Version6016
Date Added9/14/2009
FixedYes [9/15/2009]
Submitted byMarcelo Hosan
Keywords

Subject

Call commands transparently using the command-line

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;
   }
}