Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram Clicked -event (Read 3015 times)
henry k
Junior Member
**
Offline


I Love MindFusion!

Posts: 51
Location: Finland
Joined: Apr 4th, 2012
Diagram Clicked -event
Apr 13th, 2012 at 6:37am
Print Post  
Hi,

as I'm evaluating the NetDiagram component. I've encountered few problems... with events.

#1 Diagram.Clicked event is not raised (@server side)
# refer: http://www.mindfusion.eu/onlinehelp/netdiagram/E_MindFusion_Diagramming_Diagram_...
Code
Select All
// ClientSideMode=ImageMap
// @OnPageLoad or @OnInit
// Framework .NET 3.5

protected override void OnInit(EventArgs e) {
   base.OnInit(e);
   Diagram diagram = diagramView.Diagram;
   diagram.Clicked += new DiagramEventHandler(diagram_Clicked);
   // ...
}

void diagram_Clicked(object sender, DiagramEventArgs e)
{
   Console.WriteLine("123"); // Using VS2008 and this line has break-point, which never get fired.
}
 



on the other hand [NodeClicked] -event works without any problems...

#2 (same setup as above) containerFolded -event is not raised (@server side).

Am I missing something here or something?

Btw. (offtopic) FYI: Your NetDiagram 4.2 has samples of (2.0, 3.5 & 4.0) and at 2.0 your samples are using .NET Framework 3.5 components but the projects are build and "specifically" designed for 2.0... doesn't really make any sense Smiley


Br. Henry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram Clicked -event
Reply #1 - Apr 13th, 2012 at 10:08am
Print Post  
Hi,

1. The events listed for the Diagram class are raised only in the Windows Forms version of the control (the mindfusion.diagramming.dll assembly is shared between ASP.NET and Windows versions). In NetDiagram's ImageMap mode you can handle only the event listed for the DiagramView class:

http://www.mindfusion.eu/onlinehelp/netdiagram/index.htm?T_MindFusion_Diagrammin...

Perhaps you could use a large background node to detect clicks on the diagram by setting the following properties:

ZIndex = 0
IgnoreLayout = true
Locked = true
Transparent = true
Bounds = diagram.Bounds

Then the image map will contain a big rectangular area that should catch all clicks outside of other nodes' boundaries, and you can handle NodeClicked for that node as if the diagram background has been clicked.

2. It seems ImageMap mode does not support interactive folding of containers at all. You could fold them from a NodeClicked handler, e.g. this sample code folds a container when its caption bar is clicked:

Code
Select All
protected void OnNodeClicked(object sender, NodeEventArgs e)
{
	Debug.WriteLine("OnNodeClicked");
	ContainerNode ctr = e.Node as ContainerNode;
	if (ctr != null)
	{
		RectangleF rect = e.Node.Bounds;
		rect.Height = ctr.CaptionHeight;
		if (rect.Contains(e.MousePosition))
			ctr.Folded = !ctr.Folded;
	}
}
 



3. What .NET 3.5 components are you referring to exactly? I think VS2005 does not support .NET 3.5, so the samples from the VS2005/.NET 2 folder would not run if they have references to .NET 3.5 components. Samples that use mindfusion.extenders.dll require a separate MS Ajax Extensions for ASP.NET installation though - this was later integrated as standard part of ASP.NET, but it's a separate download for .NET 2.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
henry k
Junior Member
**
Offline


I Love MindFusion!

Posts: 51
Location: Finland
Joined: Apr 4th, 2012
Re: Diagram Clicked -event
Reply #2 - Apr 13th, 2012 at 12:05pm
Print Post  
Hi,

#1: this is confusing. Maybe I'm just dumb but how do you make apart which classes, methods and events are for which "platforms" (HTML5, ASP.NET, WinForms, etc.) when all is shared from one assembly?
i.e.
Code
Select All
{
   Diagram diagram = diagramView1.Diagram;
   diagram.[??] // All methods, properties, events (everything) that are listed from here are shared
                // from same assembly to different "platforms", but developers just have to guess
                // which ones are for needed/target "platform" ?
}
 



Anyways, it seems that this feature is not supported in ImageMap mode.


#2: nice... yet it's still there available, but not usable.

#3: I think this ("mindfusion.extenders.dll require a separate MS Ajax Extensions for ASP.NET installation though") part answers my question. I didn't notice any requirements on this part... but it seemed that it had one (or more)...


Br. Henry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram Clicked -event
Reply #3 - Apr 13th, 2012 at 1:06pm
Print Post  
Both WinForms.DiagramView and WebForms.DiagramView call Diagram.Draw to render themselves, so you can use everything appearance-related from the Diagram class and Diagramming namespace.

The differences (in ImageMap mode) are related to interaction. In Windows Forms the control handles mouse events and immediately updates the diagram view, while in ASP.NET all it can do is handle a postback from an AREA element in the image map, so interaction is very limited.

Regarding events, we would love to reuse the ones from the Diagram class, but it turned out you can't attach handlers to Diagram in aspx (because it isn't derved from Web.Control I think). So our developers decided to copy the relevant events to DiagramView to enable defining handlers in the aspx markup, or otherwise it would be only possible to define handlers from the code-behind.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
henry k
Junior Member
**
Offline


I Love MindFusion!

Posts: 51
Location: Finland
Joined: Apr 4th, 2012
Re: Diagram Clicked -event
Reply #4 - Apr 16th, 2012 at 12:02pm
Print Post  
Okay, thank you for your answer.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint