Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8530

Block commands from GetOption() options

$
0
0

@nathanletwory wrote:

I have code that looks like this:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
	var gopt = new GetOption(); // from Rhino.Input.Custom
	int disableIdx = gopt.AddOption("Pause");
	int enableIdx = gopt.AddOption("Unpause");
	int toggleIdx = gopt.AddOption("Toggle");
	gopt.SetCommandPrompt("Action");

	gopt.Get();

	// PROBLEM
	// we never get here if we press Pause or type Pause as the option

	Result rc = gopt.CommandResult();

	if (rc == Result.Success && gopt.Result() == Rhino.Input.GetResult.Option)
	{
		CommandLineOption clo = gopt.Option();
		// here some useful code
	} 
	return Result.Nothing;
}

It appears that using the option Pause doesn’t work since there is already a command called Pause. Is there a setting on GetOption() that prevents commands from taking precedence, or how can I ensure I can use option names that look like existing commands?

A similar problem happens when I use the string Lock (for Lock and Unlock as options).

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 8530

Trending Articles