Results 1 to 3 of 3

Thread: How can i use the mouse OFF event in visual basic?

  1. #1
    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?

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    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.

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    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.

Similar Threads

  1. Event and Exception Changes for Visual Basic 6?
    By jhon in forum Software Development
    Replies: 4
    Last Post: 27-02-2010, 06:59 AM
  2. what are Visual Basic IDE?
    By Naresh Modi in forum Software Development
    Replies: 2
    Last Post: 06-03-2009, 09:49 AM
  3. Is GUI same like Visual Basic ?
    By Caesar in forum Software Development
    Replies: 2
    Last Post: 02-03-2009, 01:32 PM
  4. Visual Basic 2005 or Visual Basic 6
    By Aasha in forum Software Development
    Replies: 5
    Last Post: 15-01-2009, 06:56 PM
  5. Visual Basic on LAN
    By djbbenn in forum Software Development
    Replies: 2
    Last Post: 05-08-2008, 02:15 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,041,134.69044 seconds with 16 queries