This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello I have a problem with FindNodeElement method. As I understand it works only for currently visible elements (that are in Viewport). Is it so? I am implementing a searching feature and I need to translate viewport to some position and select target element. So, I do the following:
But if the node located out of the current viewport, I get null. I tried to use DiagramElements and NodeElements properties, but unfortunately without success. Is it possible to get element for the node (or connection) located somewhere on the diagram? //Dmitry |
|
|
Hello Dmitry Indeed you can only get visual elements that are within or very close to the viewport area. This is a common way of improving performance. Since you need to translate the viewport to show the item you need to select anyway, then you can resolve this by doing the selection in a dispatcher after you've translated the viewport. This way the elements within the viewport you have translated to will be resolved allowing you to select them. I've made a note to improve the selection feature in the model. Let me know if you need further help with this. Jason Fauchelle |
|
|
Hello Jason Could you please notice me when the selection feature will be improved? Dmitry |
|
|
Hello Dmitry Rather than using a dispatcher, there is another approach you can take to select the items. On the DiagramSurface, there is a SelectItem method. You can pass in a model object such as a node or a connection and the diagram will mark it as selected. When the view port changes and node elements are created, it will make sure they are put into a selected state if the model has been marked as selected. Now you won't need to use the FindNodeElement method. No need to get a nightly build for this. Apologies for not mentioning this last time! Let me know if you have more questions about selection. Jason Fauchelle |
|
|
Hi Jason, I have a similar problem with multi selection. When I open the diagram the selection should be recreated. I have loaded all connection and node models that are previously selected. The diagram surface selection mode is set to extended. Unfortunately The “SelectedItems” collection is readonly, so I cannot not add them to the list. Markus |
|
|
Hello Markus Rather than using the SelectedItems collection, you can select items by passing them in to the SelectItem method of the DiagramSurface. -Jason Fauchelle |
|
|
Hi Jason, it works perfect and I'm able to restore the previous user selection. I didn't recognize the "SelectItem" method only the property. Thanks Markus |
|