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.
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 ?
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.
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.
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?
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 ???
I did some further tests and found out that the Hover detection starts to break down right after you move the nodes around !
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.
Public Class GraphView
Public Sub New()
Protected Overrides Sub DoBackgroundMouseOver(ByVal e As GoInputEventArgs)
. . . do something . . .