Custom Component - Graphical Problems

unhandled

(Robertdamian Vochescu) #1

Hi to all,
I have created a custom component:
image

But I have some troubles that i don’t know hot to resolve.
image
image

Some suggestion?
Thanks
Robert


(David Rutten) #2

Probably because the Bounds rectangles on your custom attributes only cover this area. The Bounds must contain all visible parts of your object, otherwise Grasshopper assumes your component doesn’t exist there.


(Robertdamian Vochescu) #3

Dear David,
Thank you for you response. In Layout() i upgraded the Bounds with the all rectangle dimensions. If not I will have a smalle rectangle and my Radion Button will be out.
However I can’t explain the braviour.

Thanks


(David Rutten) #4

There are additional methods on IGH_Attributes to test points for validity. I’d have to see your code though so I can test it myself. There’s always something I forgot when I’m just talking off the top of my head about this.

Can you upload a functionally stripped version of your code that only does the attribute override?


(Robertdamian Vochescu) #5

Dear David,
Here the code:

protected void FixLayout()
{
    float width = this.Bounds.Width;
    if (this.m_MinWidth > width)
    {
        System.Drawing.RectangleF rec0 = new RectangleF(this.Bounds.X, this.Bounds.Y, this.m_MinWidth, this.Bounds.Height);
        this.Bounds = rec0;
    }
    float height = this.Bounds.Height;
    if (this.m_MinHeight > height)
    {
        System.Drawing.RectangleF rec0 = new RectangleF(this.Bounds.X, this.Bounds.Y, this.Bounds.Width, this.m_MinHeight);
        this.Bounds = rec0;
    }

}

protected override void Layout()
{
    // Call the base class Method
    base.Layout();

    FixLayout();
}

Thanks


(David Rutten) #6

Looking for problems, not seeing any yet. Your object class inherits from GH_Component and your attributed inherit from GH_ComponentAttributes I assume?


(Robertdamian Vochescu) #7

Dear David, thanks for replay. Yes i checked it. I can’t understand why do this, maybe I have something that recall the dimension.