Dynamic Ports


Hey. I have a question. I have A special node that represents an
Function with unlimited parameters. I want the number of input ports
(representing function parameters) to be the number of links + 1 so
that a new parameter can always be added. I also want ports to be
removed when deleting a link (parameter) so taht the number of ports is
always Number of links + 1… I use the GoUndoManager has well… So i
only want to create new Ports when necessary…because doing undo/redo
makes the port taht dissapeared in the undo reappear in the redo…
whats the best way to be notified when a Link is created and when a
link is deleted… it would be nice if it could be done inside the node
events or something… but i am having all sorts of problems using an
observer on my ports…so what would be a nice and clean way of doing


This isn’t exactly what you want, but you might want to take a look at the AutoLinkNode class, in Demo1.


Thanks i solved the problem using

AddSourceLink and RemoveLink. Its working great!