ViewPort lost focus

Hi there,

I am developing a plugin in Rhino5. This plugin use a panel and there are some button on it .
My question is :

I clicked a button on the toolstrip and tried to use GetOneObject to get a object to do something,but after I clicked the button and tried to grip a object in the viewport,I must click two times to get it .According to my observation,I think the first click is set the viewport focus ,and the second click is choicing the object I wanted. But I tried so many times and failed to deal with it.

Any advise is highly appreciated !


Hi @hearts_j,

Try doing something like this:

[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr SetFocus(IntPtr hWnd);

private void OnButtonClick(object sender, EventArgs e)
  // TODO...

– Dale

1 Like

Thanks for your reply, @dale.
It seems not working,Maybe I have sothing missed?
But there is a solution can be work.

Thanks again.