insert item to options bar

insert item to options bar

Anonymous
Not applicable
1,103 Views
4 Replies
Message 1 of 5

insert item to options bar

Anonymous
Not applicable

I try to insert textbox to options bar in revit by API. Someone can show me how to insert textbox to options bar. thank you so much!!

0 Likes
1,104 Views
4 Replies
Replies (4)
Message 2 of 5

rosalesduquej
Alumni
Alumni

Hello Kools,

 

If you are reffering to insert or add a textbox to the Ribbon here is a great resource link on how to do something similar to what you are looking for. 

 

http://thebuildingcoder.typepad.com/blog/2010/09/simulating-a-ribbon-textbox-label.html

 

The class that will help you to add that will RibbonPanel

first create the textbox and then you can add that to your ribbon using RibbonPanel.AddItem(). 

 

Here is a small snippet of code to do something similar. 

 

var tab = application.CreateRibbonTab("tab");
RibbonPanel ToolsPanel = application.CreateRibbonPanel(tab, "Instruments");
TextBoxData tbData1 = new TextBoxData("tbName1");
TextBox tb1 = ToolsPanel.AddItem(tbData1) as TextBox; // TextBox comes from Autodesk.Revit.UI.TextBox
tb1.EnterPressed += SetTextBoxValue; //save value

 

Try it and let me know how it works.

 

Cheers,



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
0 Likes
Message 3 of 5

Anonymous
Not applicable

oh no, i mean textbox in options bar, not ribbon panel.Untitled.png

0 Likes
Message 4 of 5

Revitalizer
Advisor
Advisor

Hello 01688686718,

 

you only could try to place a dialog as an overlay for the options bar.

In this case, you need to get the rectangles of the other option controls and the options bar itself.

Also, you would need to adjust its position if the user moves or resizes the Revit host window.

 

But this is just a workaround, and it is resulting in simulating a built-in option which is in fact not Autodesk's but yourself one.

Users may be confused this way.

It would be better to follow rosalesduquej's (and Jeremy's) suggestion.

 

 

Best regards,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 5 of 5

AndrewButenko
Advocate
Advocate

Hello! Did you get work with options bar?

0 Likes