How do I stop running CRhinoGetObject?

Hi,
I use CRhinoGetObject to get objects.
When I run CRhinoGetObject to get objects again, how can stop last running CRhinoGetObject?

Kind regards,
Vaker

Can you post the code that is giving you this problem? I don’t quite understand what you mean.
Meanwhile, there is this example:

http://developer.rhino3d.com/guides/cpp/selecting_objects/

The “Add” button on a dialog:

Source code:

User clicked “Add” button 2 times.
User do nothing at the first time.
CRhinoGetObject still waiting seclection.
When user clicked “Add” button the second time, I want to stop CRhinoGetObject at the first time.
How can I do?

Kind regards,
Vaker

Hi Vaker,

Instead of embedding object picking inside of your button code, have your button run commands that run the object picking (instead). For example:

void CTest_Page::OnBnClickedAddbutton()
{
  RhinoApp().RunScript(L"! AddButtonCommand", 0);
}

void CTest_Page::OnBnClickedRemovebuttion()
{
  RhinoApp().RunScript(L"! RemoveButtonCommand", 0);
}

The “!” will cancel the previous CRhinoGetObject.

You could also disable your UI while picking was running. This way, they couldn’t pick the other button.

– Dale

1 Like

Hi Dale,

I use first way to fixed the problem.
Thanks for your help.

Kind regards,
Vaker