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

Switch focus to active viewport

$
0
0

@sarg wrote:

Sorry for the deluge of questions of late. In rhinocommon, is there a way to switch focus from an Eto control to the active viewport?

The issue I’m facing is this: I have a custom button inherited from Drawable (see this class by @curtisw), which prompts the user to select an object in Rhino. Unfortunately, the user has to click in the viewport twice for a selection to register (once to focus on the viewport, and again to select the object). I’d like to get around this by forcing focus onto the viewport, or by making the CustomButton behave like an Eto.Forms.Button, which doesn’t have this issue (see below):

var button = new Button { Text = "Button" };
var custom = new CustomButton { Text = "Custom" };
button.Click += (s, e) =>
{
    GetObject go = new GetObject();
    go.GetMultiple(1, 0); // user can now select object with a single click
};
custom.Click += (s, e) =>
{
    GetObject go = new GetObject();
    go.GetMultiple(1, 0); // user must click twice to select object
};

Any thoughts much appreciated.

Cheers,

Jon

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 8532

Trending Articles