Grasshopper

algorithmic modeling for Rhino

Hi all,

Is there a way to define a graphical component ?
I mean something like a GH Slider or other native GH
components that accept user input and are able to return a value
any time the input changes.

I have been able to show a Form by ShowDialog
(using either a script or a plug-in)
and get a value from it, but any time the
Form has to be drawn and then destroyed
before I can return a value out of the component.

I'd like to find a way to draw something permanently
on the canvas and to be able to use it at any time,
just like Slider's work ... if possible.   :)

Thanks
Emilio

Views: 260

Replies to This Discussion

Hi Emilio,

yes, this can be done, but it requires quite a bit of work. All the display and layout and mouse handling events are part of the IGH_Attributes interface. Each IGH_Document object must be capable to create its own IGH_Attributes instance. If you override CreateStandaloneAttributes and supply your own GH_Attributes derived class then you can override the display of your parameter/component.

You can have a look at the source code for the Curve Slider object (defined inside Curve.gha) using RedGate Reflector to see how that specific object was implemented.

Eventually I'll add topics to the helpfile that explain how to do this.

--
David Rutten
david@mcneel.com
London, UK
Good, I'll try to learn something from Curve.gha.

Thanks for the info, David !

Cheers
Emilio
Sorry ... I'm not able to find Curve Slider in Curve.gha.
Where should I look for it ?
Inside any Component class ?

( GH 070014 )

Emilio

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service