algorithmic modeling for Rhino
Hi All,
I am wondering how to do the following: I have a custom textbox attached to my component. I now want to save the textbox s text value to the Grasshopper file so if the file is closed and then reopened the last entered text appears in the box.
Ive set it up in the following order - however, the variable name seems to be null when the attributes override is called. How would one go about it to achieve the above mentioned?
Thanks a lot in advance!!!
Best
T
namespace Component
{
public class Component : GH_Component
{
public string name;
public override bool Write(GH_IO.Serialization.GH_IWriter writer)
{
writer.SetString("prjname", name);
return base.Write(writer);
}
public override bool Read(GH_IO.Serialization.GH_IReader reader)
{
name = reader.GetString("prjname");
MessageBox.Show("project name: " + name.ToString());
return base.Read(reader);
}
public override void CreateAttributes()
{
CustomTextbox txt = new CustomTextbox (name);
}
}
}
Tags:
So 'name' deserializes correctly, but 'new CustomTextbox(name);' fails?
What is CustomTextBox?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Welcome to
Grasshopper
© 2024 Created by Scott Davidson. Powered by