Restriction on number of objects

Thanks a lot of answering the question I have.


The questions I have seem all be easily be possible.

So one difficult question/challenge of which I wonder is an easy solution Wink

I working with the example: http://gojs.net/latest/samples/flowchart.html

Is it possible that you can only drag in one object that has only “input” connector at the top.

So I have multiple objects you can drag in, to the canvass.
There are also multiple objects that only have an input connector at the top.

Is it possible to make an restriction, you can only drag in one object that has an input connector at the top?

I hope I make my question clear. And again thanks for all the help.

Sure. But there are many ways of meeting your requirement, and I don’t know which one(s) you want.

For example, you could limit what the user could select in the Palette. In the main Diagram’s “ExternalObjectsDropped” DiagramEvent listener you could detect that a “Start” node had just been dropped, and then you could delete the “Start” node from the Palette. (By the way, you might be interested in a new sample: http://gojs.net/latest/samples/twodiagrams.html)

Alternatively you could leave the Palette alone and decide in your “ExternalObjectsDropped” DiagramEvent listener that any “Start” nodes that were just dropped should be deleted if there already was a “Start” node in the diagram (i.e. not selected).

I think if I spent more time on this I could devise alternatives to these two scenarios. You need to decide what ramifications you want or can live with.

Thanks walter, this gives enough hints to work this out.
Thanks again!