- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm after a code example or links on how a TextBoxData value entered from a ribbon panel text box can be used to set a parameter value in a class.
Text box setup on ribbon panel works as follows :
TextBoxData modifyData = new TextBoxData("ModifyBox");
TextBox modify = modifyPanel.AddItem(modifyData) as TextBox;
modify.PromptText = "Enter a value in mm";
modify.ToolTip = "Test text box";
modify.EnterPressed += new EventHandler<TextBoxEnterPressedEventArgs>(ProcessText);
void ProcessText(object sender, TextBoxEnterPressedEventArgs args)
{
TextBox textBox = sender as TextBox;
string strText = textBox.Value as string;
double doorwidth = Convert.ToDouble(strText);
}
Get & set "doorwidth" parameter in separate class as follows :
ElementId doorId = doorObj.ElementId;
Element door = doc.GetElement(doorId);
Parameter p01 = door.LookupParameter("Door Width");
using (Transaction tx = new Transaction(doc, "Set door width"))
{
tx.Start();
p01.Set(doorwidth);
tx.Commit();
}
Thanks
Solved! Go to Solution.