Help With OnMouseOver GoDiagram Windows 2


#1
Hello,
I am trying to fire an event in VB so that when the user enters a GoBasicNode I will do something and when it exits do something else. (Show Hide some Labels above Links)
I looked at the FAQ under Mouse topic and tried the OnMouseOver and DoMouseOver Overrides and can's seem to make it work. As soon as I try to do semething in the DoMouseOver of the GoView class it seems to cancel the OnMouseOver of the BoBasicNodeClass.
If I do either one of them alone then the events fires !
Would you have a very simple example to get me started ? I tried the Hover method but with many object in the GoView document it seem to break down when many nodes are present.
Thanks
Dimitri Kampouris

#2

The IconicApp sample defines BackgroundHover and ObjectHover event handlers in MainForm.vb. Instead of changing the selection, you can display other node-specific information (for ObjectHover, look at the e.GoObject.TopLevelObject value, presumably safely CType’d to a node class that you care about).
You can adjust the Hover time by setting GoView.HoverDelay (in milliseconds).
If you want to override GoObject.OnMouseOver, take a look at the GraphNode class in the FlowCharter sample.


#3

Hello Walter,
I did look at the FlowCharter sample but it seems they are using the OnBackgroundHover to turn of the nodes.
What I am trying to do is use the DoMouseOver as suggested in the FAQ.
It should be very simple but I can’t seem to make it work. Would you have a few lines of code for each override to get me going ?
Thanks
Dimitri


#4

What’s wrong with using hover events? It seems to work well for both IconicApp and FlowCharter (the latter just for detecting that the mouse is in the background). If you could describe precisely how it didn’t work for you, I’d appreciate it.


#5

When I am using the Hover method (both for On Hover a GoBasicNode and BackgroundHover) It works when the number of Nodes is small but as it increases the OnHover method stop responding. I am highlighting Links between the Node being hovered on to all it’s childrens. Then on each link I am modifying the Label and the Line Weight and Color. Gives a very nice visual effect. Since the Hover method doesn’t give me the exact behavior I need, I want to setup the equivalent of MouseEnter and MouseLeave that can be found on Windows Textbox Control.


#6

I’m trying to figure out why hover doesn’t work for you.
I just ran the FlowCharter sample, created about 4000 nodes and links, with a lot of overlaps and crossing links. As far as I can tell, it works just fine–displaying ports on each node that the mouse passes over, and then hiding all ports once the mouse rests somewhere in the background.
I also modified an application to highlight links. I overrode GoObject.OnMouseOver in the link subclass and added a GoView.BackgroundHover event handler. Again, everything works fine, even with hundreds of nodes and links.
If you have undo/redo enabled, for any changes that you are making to any objects, are you turning off the undo manager by temporarily setting GoObject.SkipsUndoManager to true?
Is it only the GoView.BackgroundHover event handler that eventually isn’t called? Does the GoLink.OnMouseOver method continue to get called?


#7

Hello and thanks for your reply,
I am doing many things in the Hover mode (database access, highlighting certain links/nodes). There might be an issue with some “doevents” logic in my code that prevents de background timer in Go to work correctly).
What really interest me at this point is to figure out on how to to it without the Hover logic. The FAQ says it can be done, but I can’t make it work.
Do you know how to do it without the Background Hover or not ???


#8

I did some further tests and found out that the Hover detection starts to break down right after you move the nodes around !


#9

Well, as you might expect, when I try stress tests using background hover events, I don’t see any problem after moving nodes around.
Anyway, if you really want to avoid defining GoView.BackgroundHover event handlers, you can just define your own view class that inherits from GoView and overrides DoBackgroundMouseOver. Be sure to call the base method, which keeps the Cursor up-to-date.


#10
I did some further testing and the Move phenomenom can be explained by the fact that I am using GoBasicNode and that the links get attached to the center of the object.
When I force layout the Goview, the Hover works better as it seems to find "hot spot" on where to hover to. (They all get distributed in a star fashion).
Then when I move the GoBasicNode, all the links must get "squeezed" and therefore no hot spot and easily findable.
To confirm this I have made my GoBasicNode Width and Heigt 50X50 and then the problem goes away. Nevermind the Goview looks out of proportion.
I will experiment further with the DoBackgroundMouseOver method. If you could send me a quick example, it would save me some time as I seem to be missing something.

#11

Public Class GraphView
Inherits GoView
Public Sub New()
End Sub
Protected Overrides Sub DoBackgroundMouseOver(ByVal e As GoInputEventArgs)
MyBase.DoBackgroundMouseOver(e)
. . . do something . . .
End Sub
End Class


#12

Thanks