Grasshopper

algorithmic modeling for Rhino

Is it possible to add buttons to the Canvas Toolbar?

Thanks.

Views: 1361

Replies to This Discussion

Yes.

Attachments:

I see. It can be done by accessing the private field Grasshopper.GUI.GH_DocumentEditor._CanvasToolbar using reflection. Thanks for the hack.

Alan

Hi, you can also directly access the Toolbar object without using reflection: 

ToolStrip toolbar = Instances.DocumentEditor.Controls[0].Controls[1] as ToolStrip;
toolbar.Items.Add("Hey I just got inside the toolbar");

FYI, You may wonder how I figured out that the toolbar is located at indices ".Controls[0].Controls[1]" in the code above (when you do not have access to the Grasshopper source code) ?. Well I wrote a simple C# script (attached) that hierarchically lists in all the child controls of the DocumentEditor form. This can be useful if you also so want to hack into other control in the Grasshopper editor as well.

Attachments:

Thanks. This works great.

Alan

a little help....

how do I add: preview on | preview off | enable | disable buttons?

thank you!

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service