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
|
Can you advise how to have the connection thumbs highlighted when I drag an object over the node please? I need to be able to drop an object onto a connection thumb. Cheers, Mark |
|
|
Hello Mark At the moment, detecting abitrary objects being dragged over a node is not possible. We can add this functionality, but would like to know more information about what your want, such as what is to happen when an object is dropped onto a connection thumb. Cheers |
|
|
Thanks for your quick response Jason. Currently we have our own toolbox and drag and drop manager. When we drop one of our tools on the design surface we create a custom node that has a variable number of connection points with tooltips on each point. We would like, if possible to be able to drop our custom tool directly onto a connection point, have our app detect this, create the new node below the drop point and automatically connect the two custom nodes together. The extra request would be to have the tooltips display for the connection point when dragging over them the same as we have working now when not dragging and just hovering. We can handle creating the new node in a different location and connecting them together in code. Although we haven't connected two nodes together in code yet I assume this would be fairly basic. I hope this makes sense. Cheers, Mark
|
|
|
Hello Mark Thanks for this, it helped a lot to get this functionality sorted. Here is what you can do when you get tonights nightly build: On DiagramSurface there is now a FindMouseOverElement method which returns a DiagramElement. Firstly your going to want your draggable controls to have access to the DiagramSurface. When the control is being dragged, it can call this new method on DiagramSurface, and cast the result to a DiagramNodeElement using the 'as' operator. From this, when you know that the mouse is over a DiagramNodeElement, you can use the new method on it called ShowConnectionPointControls. This method takes in a ConnectionPointShowFlags parameter. In your case you will probably want to use ConnectionPointShowFlags.Outbound. The standard styles will then do all the rest. This will allow the connection points of a node element to become visible when your draggable control is dragged over a node. Note that when using the ShowConnectionPointControls method, you will be responsible for making sure the connection points are then hidden again when the mouse is not over the node anymore, and also when the dragged item has been dropped. For this you can use the HideConnectionPointControls method. Then, once you custom tool has been dropped, you can use the FindMouseOverConnectionPoint method on the DiagramNodeElement which returns the IDiagramConnectionPoint that the mouse is over. Or null if the mouse is not over a connection point. This will be available through tonights nightly build. Let me know if you need more clarification about how some of it works, or if there is still something missing. As for the tooltips, the best way to do this may be to make your own kind of tooltip. A tooltip is simply a Popup control. You could have a popup on the connection points along with the tooltip, and then have a trigger that uses the IsFromConnectionDragOver property to decide if the popup should be visible or not. Hope this helps. Cheers |
|
|
By the way, the next nightly build will be available on the 15th. |
|
|
Thanks Jason. I'll check out what you suggest when I get the new build. Will that be 15th business hours Aussie time? I.E. It will be building tonight? |
|
|
Indeed it is building tonight, so will be available to you tomorrow. |
|
|
Hi Jason, Unfortunately we can't get it to work. FindMouseOverElement returns something when we reference it in DiagramSurface.MouseMove but not in DiagramSurface.DragOver. It always returns nothing in the latter case. diagSurface is our DiagramSurface control instance Private Sub diagSurface_DragOver(ByVal sender As Object, ByVal e As System.Windows.DragEventArgs) Handles diagSurface.DragOver
Never displays a message Please let me know if you need more info |
|
|
Hello Mark The way I got it to work was by putting some additional logic in the DiagramNodeTool class. This class has a private method called OnQueryDropPosition which is called whenever a DiagramNodeTool is being dragged over the DiagramSurface. This is where I experimented with finding the node that the mouse is being dragged over, and then highlighting it's connection points. So getting it to work in your application may depend on how you have implemented you draggable controls. If you could give us any details of how you have done this, or better yet, send us a sample, then it will be easier to find a solution. If you do send a sample, make sure you remove the binaries first. Cheers |
|
|
Thanks Jason, Ignoring our implementation of drag and drop for now ( unless that is crucial to your response ) I guess we need to know how and when FindMouseOverElement will return an element and not null. We've tried various events that the DiagramSurface raises with mixed success. I.E. MouseMove works but DragOver doesn't. Ideally we just need the DiagramSurface to throw us something when the DragOver event is raised of said surface. Is that possible? Cheers, Mark |
|
|
Hello Mark I have looked into this some more, and indeed I am seeing the same results as you when using the DragOver event. I have done a little bit of experimenting, but get mixed results depending on how I implement the dragging. It seems your implementation of drag and drop is crucial to getting it to work the way you want. A simplified sample of what you are doing will help a lot. Cheers |
|
|
To simplify things ( I think ) I decided to modify one of your samples to see if I could replicate the problem which I can. I added the DragOver event handler to the design surface of the DiagramSurfaceSample in your samples private void ds_DragOver(object sender, DragEventArgs e) I then run the project and attempt to drag from a Windows Explorer window any file across the surface. Regardless of whether I drag my file over a node or just the surface itself the ds.FindMouseOverElement() method above always returns null. If you can get that to work then we're in business and we can take it from there. It's going to be complicated to give you all the bits and pieces from our app that you would need but this is the exact same problem. Your help is appreciated. Cheers, Mark
|
|
|
Hello Mark Thanks for this, this was one of the things I was experimenting with. It will be easier now to get this working. I'll look into this more as soon as I can. Cheers |
|
|
Hello Mark I have mad a slight modification to the DiagramSurface to allow this to work using the DragOver event handler. Here's what you can now do: private void ds_DragOver(object sender, DragEventArgs e) Note that I am now using the new FindElementAtPoint method, and passing in the point generated by the event args. This will get you further with your dragging feature, but you may come across a similar problem when trying to get the IDiagramConnectionPoint. Let me know how this new stuff works out for you. This will be available throught the nightly build download tomorrow the 21st. - Jason |
|
|
Apologies for the late reply Jason. That worked for me. You were right in that I can't get the connection points on drag as I only show those when dragging over a node so I figure the easiest way is to calculate the closest connection point when dropping on the activity node. I know the locations because we set them in code. So this worked perfectly for us. Thanks again for you assistance. Cheers, Mark |
|
|
Excellent, good to hear it all worked out. - Jason |
|