Mouse Over event

Post

Posted
Rating:
#1 (In Topic #1414)
Regular
rj71 is in the usergroup ‘Regular’
I've been experimenting with mouse over events from an example I found on the Gambas wiki. It uses MouseMove and I can get a border to appear around a button, picturebox and label when the mouse moves over it. How would I go about making the border go away when the mouse leaves the control it was over? Here's the code I found on the wiki:

Code (gambas)

  1. Public Sub Form_Open ()
  2.  
  3.  Label1.Tracking = True
  4.  
  5.  
  6.  
  7. Public Sub Label1_MouseMove ()
  8.  
  9.  'Me.Title = Cstr (Mouse.X) & "-" & Cstr (Mouse.Y)
  10. Label1.Border = 3
  11. 'I actually wanted a colored border like this:
  12. 'Label1.BorderColor = Color.Red ' but it doesnt work
  13.  
  14.  

I tried to google some examples and it's AI returned a chunk code that didn't work but it had something about a Mouse_Enter event and Mouse_Leave event….but I couldn't find anything about those. Do those 2 things even exists or does Google's AI need some work?
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
 Forget all of that.

Just use these events..

Label1_Enter

Label1_Leave

Leave and enter events are Control.class events not Mouse events.
Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’
Also after changing things (like border colour) if it does not seem to work it might need to finish with Label1.Refresh
Online now: No Back to the top

Post

Posted
Rating:
#4
Regular
rj71 is in the usergroup ‘Regular’
 Thanks Bruce! Exactly what I was looking for. I guess I was just looking in the wrong place. The border color doesn't work even with the label1.Refresh but that's ok because I think I'm going to do something a little different now. Much Appreciated!
Online now: No Back to the top

Post

Posted
Rating:
#5
Guru
BruceSteers is in the usergroup ‘Guru’
Where exactly did you find that "mouse over" example on the wiki?
Online now: No Back to the top

Post

Posted
Rating:
#6
Regular
rj71 is in the usergroup ‘Regular’
Online now: No Back to the top

Post

Posted
Rating:
#7
Regular
rj71 is in the usergroup ‘Regular’

rj71 said


I just realized that's a different wiki than the gambaswiki.org
Online now: No Back to the top

Post

Posted
Rating:
#8
Guru
BruceSteers is in the usergroup ‘Guru’
Aah I See. I thought you meant the Gambas wiki. Not the Italian user forums wiki.

Never mind. <EMOJI seq="1f60a" tseq="1f60a">😊</EMOJI>

Wishing well
Online now: No Back to the top

Post

Posted
Rating:
#9
Guru
BruceSteers is in the usergroup ‘Guru’
That example is specifically for showing mouse x and y positions as the mouse moves.

It's terrible for any other purpose  8-)

That's why I asked.
Online now: No Back to the top

Post

Posted
Rating:
#10
Regular
rj71 is in the usergroup ‘Regular’

BruceSteers said

That example is specifically for showing mouse x and y positions as the mouse moves.

It's terrible for any other purpose  8-)

That's why I asked.

Ah, ok, I've learned something new today. Thanks again Bruce!
Online now: No Back to the top
1 guest and 0 members have just viewed this.