Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Mouse Pointer over Arrow (Read 3692 times)
Pravin
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Apr 12th, 2007
Mouse Pointer over Arrow
Apr 25th, 2007 at 5:30pm
Print Post  
Hi,

Actually I want something like this. I am using FlowChart.NET as Webapplication in which Suppose If mouse pointer moves over an arrow, I want that arrow to be selected and the arrow color should be changed to some color and again once the mouse pointer leaves the arrow, the arrow color should restore to its old color.

I actually i wrote the code like this.

Private fc as flowchart

Private Sub fc_mouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)

Dim mousePos As PointF = fc.ClientToDoc(New Point(e.X, e.Y))
Dim bar As Arrow = fc.GetArrowAt(mousePos, 1)
bar.Selected = True
bar.FillColor = Color.Red

End Sub


When i tried with this code, It does not do anything. What sort of changes i need to do.
Please suggest me or give a piece of sample code.

Thanks,
Pravin
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mouse Pointer over Arrow
Reply #1 - Apr 25th, 2007 at 5:58pm
Print Post  
Hi,

The control does not raise MouseMove events on the server side. Unfortunately, you cannot do much on the client side either when using the webchart.dll to render image-maps.  If you need any interactivity on the client side, better use the applet from the JDiagram component, or try the beta version of our ASP.NET control -

https://mindfusion.org/JDiagramTrial.zip
https://mindfusion.org/_beta/NetDiagram.zip

Stoyan
  
Back to top
 
IP Logged
 
Pravin
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Apr 12th, 2007
Re: Mouse Pointer over Arrow
Reply #2 - Apr 28th, 2007 at 5:39am
Print Post  
Actually I am using the WebChart.dll for creating my web application, I want to highlight the arrow when the mouse moves over that arrow.

Do you mean to say that I can not do that using webchart.dll in web application even by adding the attributes onMouseEnter/onMouseLeave to the AREA TAG by calling the server side function script?

If it is possible with WebChart.dll, Could you tell me how to do that.

Thanks,
Pravin
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mouse Pointer over Arrow
Reply #3 - Apr 28th, 2007 at 7:26am
Print Post  
I don't know much html, but if the AREA element lets you set its fill or border color, it will be pretty easy to implement highlighting by changing any of these colors from the mouse Enter/Leave handlers.

If that's not possible, you might need to do a postback and regenerate the whole image on the server side, just to change the arrow color. I don't think doing postbacks upon mouse movements is a good idea though...

Another option is to generate a set of images, each one having an arrow drawn in a different color, and load them all at once on the client side in an image array. Then when the mouse moves you can just display a different image. The drawback is that it might take a lot of time to load the page initially, depending on the number of arrows you have.

Stoyan
  
Back to top
 
IP Logged
 
Pravin
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Apr 12th, 2007
Re: Mouse Pointer over Arrow
Reply #4 - Apr 29th, 2007 at 7:27am
Print Post  
Hi Stoyan,

Could you give any sample code how to postback and regenerate the image on the server side for highlighting the box or the arrow on which the mouse pointer moves over.

Thanks,
Pravin
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mouse Pointer over Arrow
Reply #5 - Apr 30th, 2007 at 5:37am
Print Post  
Hi Pravin,

You can use the GetPostBackEventReference method to get a reference to the ASP.NET JavaScript function that posts back the page. Use that function from an onEnter/onLeave handlers. Before posting, assign the ZIndex of the box or arrow to a hidden field, so that you can identify the object that should be highlighted on the server side. E.g. while enumerating all objects in the diagram

string postbackScript = Page.ClientScript.GetPostBackEventReference(this, "onEnter");
string onEnterScript = "idOnEnterHiddenField.value = " + obj.ZIndex.ToString() + ";" + postbackScript;

Now on the server side you can check the idOnEnterHiddenField value, and if it is set, convert it to integer and use flowChart.Objects[zIndex] to find which object should be highlighted.

Stoyan
  
Back to top
 
IP Logged
 
Pravin
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Apr 12th, 2007
Re: Mouse Pointer over Arrow
Reply #6 - May 2nd, 2007 at 6:05pm
Print Post  
Hi Stoyan,

Thanks for your reply. As a newbie, But i still could not understand, how to do that  Sad. Do you code examples or samples related to this so that i can refer that.

Thanks,
Pravin
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mouse Pointer over Arrow
Reply #7 - May 3rd, 2007 at 8:25am
Print Post  
Here is a modified WebApp sample that implements the onmouseover handling.

https://www.mindfusion.org/_samples/WebApp.zip

You can implement the onmouseout part in a similar manner. I guess you will need to add some boolean flag to the page and prevent onmouseover postbacks just after loading the page, otherwise the page will keep reloading until the user moves the mouse away from the arrow...

Stoyan
  
Back to top
 
IP Logged
 
Pravin
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Apr 12th, 2007
Re: Mouse Pointer over Arrow
Reply #8 - May 4th, 2007 at 5:21am
Print Post  
Hi Stoyan,

Private Sub hb_CreatingArea(ByVal sender As Object, ByVal e As AreaEventArgs)



Dim item As ChartObject = e.Item



If TypeOf item Is Arrow Then




Dim postbackScript As String = GetPostBackEventReference(this,"onEnter")




Dim onEnterScript As String = "getElementById('onEnterItemId').value = " + item.ZIndex.ToString() + ";" + postbackScript




Dim script As String = " onmouseover=\"" + onEnterScript + "\""





e.AreaTag = e.AreaTag.Insert(e.AreaTag.Length - 1, script)



End If


End Sub

It gives the error as ---- Name 'this' is not declared

What does the control should i pass here..??

Thanks,
Pravin
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mouse Pointer over Arrow
Reply #9 - May 4th, 2007 at 6:25am
Print Post  
Hi, Use "Me" in VB.NET.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint