algorithmic modeling for Rhino
in the constructor of grasshopper component, after the mybase.new call, i try to
hook an event like shown. but the event don't seem to fire.
shared cntr as integer = 0
Public Sub New()
MyBase.New("Surfaces", "Sur", "Description", "Ajay", "Surfaces")
If SurfacesComponent.cntr = 0 Then
AddHandler ActiveCanvas.ControlAdded, AddressOf Me.ctrladded
SurfacesComponent.cntr += 1
End if
End sub
Private Sub ctrladded(ByVal sender As Object, ByVal e As ControlEventArgs)
MsgBox("ctrl added")
End Sub
Any help will be appreciated, already spent two days frying my brains and eyeballs.
Tags:
What controls are you looking for? The canvas typically doesn't contain winform controls (exceptions are when you double click sliders or scrollers, there will briefly be a textbox on the canvas).
--
David Rutten
david@mcneel.com
Poprad, Slovakia
These are curve parameter components and custom created components. I am trying to automatically generate the input components like curve and then hook them to my custom created component when the user places my component on the canvas.
Objects on the canvas (like IGH_Param and IGH_Component derived classes) are not winform controls. The canvas is completely owner-drawn and handles all mouse and key events from scratch (with the aforementioned exception of text input boxes when double clicking sliders or scrollers).
If you want to watch for the addition of objects to a document, then you need to handle the ObjectsAdded event on whatever GH_Document the canvas is currently displaying. Luckily the canvas retransmits this event so you can just handle Document_ObjectsAdded event on the ActiveCanvas and you don't have to worry about documents being switched about.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by