Grasshopper

algorithmic modeling for Rhino

Dear all,

I have written my own custom implementation of the ValueList component. While I can get the component to display balloons when there is an error the color of the component doesn't change to match that of the ballons e.g red for error, yellow for warning.

How can I render the component so that it is either yellow or red?

Many thanks!

Views: 708

Replies to This Discussion

Do you mean that the color changes like the param Font which turns yellow when warning,red when error?

Hi Panda,

Yes this is what I mean

In your attributes, you must override the AllowMessageBalloon property and return true. This will allow the messaging widget to draw balloons if there are warnings/errors on your component.

In order to change the colour of the component to reflect the current messaging state, the correct GH_Palette enum must be selected prior to drawing the capsule. This is the code that GH_Component uses to determine what palette to draw the capsule in:

Dim palette As GH_Palette = GH_CapsuleRenderEngine.GetImpliedPalette(Owner)
If (palette = GH_Palette.Normal) AndAlso (Not Owner.IsPreviewCapable) Then
  palette = GH_Palette.Hidden
End If
Dim capsule As GH_Capsule = GH_Capsule.CreateCapsule(Bounds, palette)

Thank you David!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service