Profile Picture

Drop a navigation bar item onto a document

Posted By Marco Hokke 10 Years Ago
Author
Message
Pochien Kao
Posted 10 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 1, Visits: 2
Hi
Did this problem was solved? I have the same requirement, but I just dont want to use customized shapes.
The DragDrop event did not work in the NDrawingView canvas area!

Pochien

Nevron Support
This post has been flagged as an answer
Posted 10 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:38 AM
Posts: 3,054, Visits: 4,006
Hi,
To set the text of the dropped shape you can subscribe to the NodeInserted event of the drawing document's event sink service and set the text to the desired one in the event handler:



document.EventSinkService.NodeInserted += OnNodeInserted;

private void OnNodeInserted(NChildNodeEventArgs args)
{
NShape shape = args.Child as NShape;
if (shape != null)
{
shape.Text = "My Text";
}
}


Best Regards,
Nevron Support Team



Marco Hokke
Posted 10 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 2, Visits: 19
Hi,
just wanted to let you know I have solved the first part of my problem. I use the LibraryBrowser with my custom shapes in it to both offer predefined objects and a drag/drop mechanism.
The second part I run into now is how to configure the shape that's been dropped. I can't seem to get a reference to the shape that ends up in the document.
I can get the dropped object of type NLibraryDataObject, find its first Masters object and get the first child from that NMaster. That gives me a shape object, of which I adjust the Text property.
However, the text property on the shape that is part of the document isn't updated.

What I want is to populate the tag and text and other properties of the shape that will be part of the document. I try to do it this way:
Dim l_objDroppedItem As Object = args.Data.GetData(args.Data.GetFormats()(0))
If TypeOf l_objDroppedItem Is NLibraryDataObject Then
    Dim l_objLibraryObject As NLibraryDataObject = l_objDroppedItem
    Dim l_objShape As NMaster = l_objLibraryObject.Masters(0)
    DirectCast(l_objShape.GetChildAt(0), NShape).Text = InputBox("Transaction name:")
End If


Can you guide me in the right direction please? Thanks!


Marco Hokke
Question Posted 10 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 2, Visits: 19
Hi,
I am trying to implement drag/drop support for an NDrawingView that is connected to a document.

The object I want to drag onto the document is a NavigationBarItem (from another vendor). I seem to be able to drop it onto the scrollbars of the DrawingView, but not onto the 'canvas' area.
Can you please tell me what I am doing wrong?

This code is implemented for the DragOver
If Not TypeOf e.Data.GetData(e.Data.GetFormats()(0)) Is DevExpress.XtraNavBar.NavBarItemLink Then
            e.Effect = DragDropEffects.None
        Else
            e.Effect = DragDropEffects.Copy
        End If

and it works for an ordinary panel. Of course, the DragOver for the document has different parameters (args rather than e), but the code is of the same structure and intent.

Marco Hokke




Similar Topics


Reading This Topic