algorithmic modeling for Rhino
I have recently upgraded to the latest version of grasshopper. I hadn't upgraded in a while. I now find that my components which had a member that was derived from GH_ComponentAttributes no longer bring up a dialog box(winform) when double clicked. I override:
public override Grasshopper.GUI.Canvas.GH_ObjectResponse RespondToMouseDoubleClick(Grasshopper.GUI.Canvas.GH_Canvas sender, Grasshopper.GUI.GH_CanvasMouseEvent e)
This was working great in the previous release but no longer seems to. Any ideas on how i can get my dialog boxes working again?
Tags:
Hi Erik,
have you compiled against the new version? If yes, I assume there are no errors or warnings? If no, can you please test that?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Yes I am compiling using version 1.0.0.20. and i get no errors or warnings at compile time.
To be more exact my code is as follows:
public class resEdges : GH_Component
{
public resEdges()
: base("Restrain Edges", "ResEdge", "Restrain Edges", "RhinoBIM", "DOFs")
{
base.m_attributes = new HelperAttributes(this);
}
and then in the helper attributes class i have:
class HelperAttributes : GH_ComponentAttributes
{
resEdges c;
public HelperAttributes(resEdges _c)
: base(_c)
{
c = _c;
}
public override Grasshopper.GUI.Canvas.GH_ObjectResponse RespondToMouseDoubleClick(Grasshopper.GUI.Canvas.GH_Canvas sender, Grasshopper.GUI.GH_CanvasMouseEvent e)
{
Rhino.RhinoApp.WriteLine("double click called\n");
c.ShowDialog();
return base.RespondToMouseDoubleClick(sender, e);
}
}
But Rhino fails to write the line "double click called"
Thanks
Ahhh, it's because you're being a naughty boy!
You're not supposed to assign the m_attributes field from the constructor, you're supposed to override the CreateAttributes() method.
public override void CreateAttributes()
{
m_attributes = new HelperAttributes(this);
}
the reason it used to work is because my default implementation of CreateAttributes checked to see whether the m_attributes field had already been set, and wouldn't overwrite if it had. Now it always assigns new attributes regardless, so your attributes were being overwritten with the default ones.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks David! Everything is up and running again.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by