Hi all,
I have mad a custom component starting from an example file by @DavidRutten , everything worked fine for me and I am almost done with the new UI, . There are only couple of issues which I would rather post one by one.
First , the output parameter do not render properly as you can see in the screen shot.
Any help is appreciated.
protected override void Layout()
{
// draw basic layout
base.Layout();
GHCustomComponent owner = Owner as GHCustomComponent;
if (owner.CustomControls.Values.Count == 0)
return;
// we add the custom constrols to the buttom of each other in the same order they have been added to the dictionary
// the value buttom records the buttom postion of the controls as they are being added
float buttom = Bounds.Bottom;
// to find the overal widht of the component we find the maximum width of the customcontrols
float maxWidth = Bounds.Width;
foreach (IGHCustomControl item in owner.CustomControls.Values)
{
float w = item.GetWidth();
if (maxWidth < w)
maxWidth = w;
}
foreach (IGHCustomControl item in owner.CustomControls.Values)
{
float h = item.GetHeight();
// set the item bounds , we expand the bounds by 2 units from each side
item.Bounds = new RectangleF(Bounds.X, buttom, maxWidth, h);
buttom += h+_offset; // update the buttom value
}
if (maxWidth > Bounds.Width)
{
// update the output parameter layout layout
int paramWidth = Owner.Params.Output.Max(
p => GH_FontServer.StringWidth(
(CentralSettings.CanvasFullNames) ? p.Name : p.NickName
, GH_FontServer.Standard
)
);
LayoutOutputParams(Owner, new RectangleF(Bounds.X, Bounds.Y, maxWidth - paramWidth, Bounds.Height));
}
var corner = new PointF(Bounds.X - _offset, Bounds.Y - _offset);
Bounds = new RectangleF(corner, new SizeF( maxWidth+2*_offset,Bounds.Height+ buttom- Bounds.Bottom+2*_offset));
}