Profile Picture

NLineShape Does not appear

Posted By Montford Chelliah 14 Years Ago
Author
Message
Montford Chelliah
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1

Hi,

I am doing a workflow application (something similar windows workflow) using Nevron diagram. This workflow, I am planning to add few custom controls that can be dragged and dropped into designer surface.

I have created a sample application (attached with this mail), that contains "IfElseActivity" and "RootActivity" custom controls. I am adding "RootActivity" control at the load event of the form and "IfElseActivity" user can drag and drop on to the surface.

Either case I am facing a problem with the NLineShape object. The NLineShape does not display on designer surface. Please advice me.

Thanks

Anslum

 



Attachments
NevronWorkflow.zip (65 views, 64.00 KB)
Nevron Support
Posted 14 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: Last Week
Posts: 3,054, Visits: 4,009

Hi,

Prior to specifying the shapes being connected you must add them to a drawing document. Let's take a look at the class RootActivity you have attached to your post. All you have to do is to modify the te first constructor:

 

public RootActivity(NDrawingDocument document, int xPosition, int yPosition)

{

      document.ActiveLayer.AddChild(this);

      CreateRoot(xPosition, yPosition);

}

 

 

Also do not forget to remove from your MainForm the line of code that adds the activity group:

 

document.ActiveLayer.AddChild(root);

 



Best Regards,
Nevron Support Team



Montford Chelliah
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1

Hi,

Thanks for information. The trick only works on root activity, but it does not work properly on IfElseActivity. When I do that in IfElseActivity, it adds two instances on drawing surface. Do I need to do some otherway for drag and drop control such as IfElseActivity?

Please advice me

Thanks,

Anslum



Nevron Support
Posted 14 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: Last Week
Posts: 3,054, Visits: 4,009

Hi Anslum,

For the case of drag and drop you should implement your own data object and data adaptor. To see a sample implementation take a look at the following example that comes with the diagramming component: C# Examples -> Drawing View -> Custom Drag and Drop.



Best Regards,
Nevron Support Team



Montford Chelliah
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1

Hi,

I followed same step on my sample (refer Mainform at NevronWorkflow project) application. In that case the NLineShape objects are not visible on the drawing surface. I hope that is my original question.

Thanks

Anslum

 

 

 



Nevron Support
Posted 14 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: Last Week
Posts: 3,054, Visits: 4,009

Hi,

Let me explain you in more details: you will need a dummy drawing document to place the dragged shape in, in order to get the connectors working. You can easily do this by in the AdaptTableFormat of the data object adaptor:

 

protected virtual NDrawingDataObject AdaptTableFormat(string tableName)

{

      NDrawingDocument dummy = new NDrawingDocument();

      NShape shape = null;

      if (tableName == "1")

      {

            shape = new IfElseActivity(dummy);

      }

      else

      {

            shape = new NRectangleShape(0, 0, 50, 50);

      }

 

      NDrawingDataObject ddo = new NDrawingDataObject(dummy, new INDiagramElement[] { shape });

      return ddo;

}

 

Do not forget to add the shape to the document as soon as it is created (for example in the constructor):

 

public IfElseActivity()

{

}

 

public IfElseActivity(NDrawingDocument document)

{

      document.ActiveLayer.AddChild(this);

      CreateBranches();

}

 



Best Regards,
Nevron Support Team



Montford Chelliah
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1

Hi,

Thanks for the details and It is working fine. I have another clarification regarding the positioning of the shape. Is it possible to specify the location of the control while we are dropping on the surface. I meant, I want to drop the shape on perticular location not rather any place on the drawing surface. How do I pass the coordinates? and which class (NMyDragDropTargetTool or NMyDataObjectAdaptor) and which method?

Thanks

Anslum



Nevron Support
Posted 14 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: Last Week
Posts: 3,054, Visits: 4,009

Hi,

In order to do that you should override the EndMove method of the drag drop target tool:

 

protected override void EndMove(bool commit)

{

      if (commit == false)

      {

            base.EndMove(commit);

            return;

      }

 

      NNodeList elements = View.PreviewManager.EndMovePreview(true, true);

      if (elements.Count == 0)

            return;

 

      if (elements[0] is IfElseActivity)

      {

            // Get the dropped element

            IfElseActivity activity = (IfElseActivity)elements[0];

 

            // Set its location

            activity.Location = new NPointF(100, 100);

      }

      else

      {

            base.EndMove(commit);

      }

}

 



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic