Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 26-02-2009
Member
 
Join Date: Feb 2009
Posts: 7
How can i use the mouse OFF event in visual basic?

Hello!

How can i use the mouse OFF event in visual basic?
Reply With Quote
  #2  
Old 26-02-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: How can i use the mouse OFF event in visual basic?

For your "mouse off event" the following code tells the object to move to an x position of 100 on roll out (roll out is the correct mouse off) obviously you will have to change the properties to make your button do what you want it to do.

Code:
//attach this code directly onto your button
on(rollOut){
    this._x = 100;
}
Personally I prefer attaching the script to the timeline as opposed to the object if you want to do it this way use:

Code:
//attach this code to the timeline on a locked layer named actions
this.yourbutton_btn.onRollOut = function(){
    this._x = 100;
}
This is more long winded but if you are using alot of code it makes it easier to locate it as it will all be in the timeline. Note: If using this method don't forget to give your button a instance name, you can double check this by targeting your button using the target option in the actions window.
Reply With Quote
  #3  
Old 26-02-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: How can i use the mouse OFF event in visual basic?

Unless VB.Net has a mouse off event (which it might, I don't know), The answer is "there isn't one". I know VB6 doesn't have one. The only way to find out if the mouse has gone off the form is to use an api call. You need to use the getcursorpos api, and pass it the POINTAPI Type. This will effectively give you the current X Y coordinates of the mouse.
Then, you get the current X, Y coordinates of your form (maybe using getwindowrect, with type RECT), and then compare to see if the mouse falls within those boundaries. If it is within those boundaries, the mouse is on the form. If it's not, then it isn't. So you could use a timer control, and check every millisecond where the mouse is. As long as it's on your form, set a variable to true. When it leaves your form, set it false, and execute some kind of "off form" code. Another option, is to set a global hook on the mouse, and whenever you recieve a WM_MOUSEMOVE, check it's coordinates, compare, and execute.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How can i use the mouse OFF event in visual basic?"
Thread Thread Starter Forum Replies Last Post
Event and Exception Changes for Visual Basic 6? jhon Software Development 4 27-02-2010 06:59 AM
what are Visual Basic IDE? Naresh Modi Software Development 2 06-03-2009 09:49 AM
Is GUI same like Visual Basic ? Caesar Software Development 2 02-03-2009 01:32 PM
Visual Basic 2005 or Visual Basic 6 Aasha Software Development 5 15-01-2009 06:56 PM
Visual Basic on LAN djbbenn Software Development 2 05-08-2008 02:15 PM


All times are GMT +5.5. The time now is 11:48 PM.