protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
GetOption go = new GetOption();
go.SetCommandPrompt("Select an action");
go.AcceptNothing(true);
int a_index = go.AddOption("A");
int b_index = go.AddOption("B");
int c_index = go.AddOption("C");
int d_index = go.AddOption("D");
while (true)
{
GetResult res = go.Get();
if (res != GetResult.Option)
break;
CommandLineOption option = go.Option();
if (null != option)
{
if (option.Index == a_index)
RhinoApp.WriteLine("Action A selected");
else if (option.Index == b_index)
RhinoApp.WriteLine("Action B selected");
else if (option.Index == c_index)
RhinoApp.WriteLine("Action C selected");
else if (option.Index == d_index)
RhinoApp.WriteLine("Action D selected");
}
continue;
}
return Result.Success;
}
Thank you Dale, but this is not what I’m looking for.
With GetOption, an action is triggered by pressing KEY+ENTER or KEY+SPACEBAR, while I want the action to be triggered by the relative key alone. This is because those keys cycle through options (for example: W is “rotate object +90 degrees”, S is “rotate object -90 degrees”), and those options might be cycled through very quickly and frequently, so adding an extra key to press every time an action is triggered breaks immediacy and intuitiveness.
Anyways, if hiding those keypresses is not possible it’s not a huge deal, I was only wondering whether I missed something. Maybe an option to hide the Command line output when capturing Keyboard events could be an idea for future versions of RhinoCommon.