VB4-32bit query - MOUSEOVER ? 
Author Message
 VB4-32bit query - MOUSEOVER ?

Chaps,

VB4 does not have a MOUSEOVER event, at least as far as I can tell it
doesnt. What I want is to change the picture in an image control when the
mouse moves over it, then back to its original picture when the mouse
leaves. I know I can do this if a mouse button is pressed, however thats NOT
what I am after - just a mouse, wandering around the screen with no buttons
down, with images changing as the mouse moves over the image controls - any
thoughts ?

Rob.


http://www.*-*-*.com/



Sun, 02 Jul 2000 03:00:00 GMT  
 VB4-32bit query - MOUSEOVER ?

Use the mousemove event.

If the control you want to capture the events with does not have a mousemove
event, subclass the control and capture mousemove events with the API

Dave

Quote:

>Chaps,

>VB4 does not have a MOUSEOVER event, at least as far as I can tell it
>doesnt. What I want is to change the picture in an image control when the
>mouse moves over it, then back to its original picture when the mouse
>leaves. I know I can do this if a mouse button is pressed, however thats
NOT
>what I am after - just a mouse, wandering around the screen with no buttons
>down, with images changing as the mouse moves over the image controls - any
>thoughts ?

>Rob.


>http://www.stonecold.co.uk



Sun, 02 Jul 2000 03:00:00 GMT  
 VB4-32bit query - MOUSEOVER ?

One way to do it (and I've posted this in several ways before) is to use
the MouseOver event of a control to change the image to the MouseOver image
and to start a timer going (every 1/4 or 1/2 second is usually fine).  In
your case, since you're using multiple controls (aka a Control Array), you
might want to set a variable equal to the Index of the control that fired
the MouseOver event.  In the Timer event of the timer, you get the mouse
position (GetCursorPos in conjunction with ScreenToClient works fine).
Compare the mouse position with the Left, Top, Width and Height of your
control.  If the mouse is inside the control, then do nothing.  If its
outside, then restore the image and reset the timer to being off.

This technique is relatively fast and easy to implement and avoids those
"jerk the mouse off the control" errors that some other techniques (like
SetCapture) will engender.

------------
Jim Houghtaling

email:  hmm... no.
web:   working on it (heh)
platform(s):  Win95 os/r2, WinNT 4.0 sp3, VB5ee sp3
('till I get my page up go to VBNet...It's the best I've seen yet.)
http://home.sprynet.com/sprynet/rasanen/vbnet/default.htm
------------
It often shows an excellent command
of language to say nothing.



Quote:
> Chaps,

> VB4 does not have a MOUSEOVER event, at least as far as I can tell it
> doesnt. What I want is to change the picture in an image control when the
> mouse moves over it, then back to its original picture when the mouse
> leaves. I know I can do this if a mouse button is pressed, however thats
NOT
> what I am after - just a mouse, wandering around the screen with no
buttons
> down, with images changing as the mouse moves over the image controls -
any
> thoughts ?



Sun, 02 Jul 2000 03:00:00 GMT  
 VB4-32bit query - MOUSEOVER ?

I do that a lot in multimedia programs. What I do is to place a code in
MouseMove event of the control with a flag that loads the picture in the
image control when the mouse is in it. It looks like this:

  Form MouseMove
        if bLoad = False
          Picture.picture = LoadPicture(<name of BMP when NOT passing
over>)
          bLoad = TRUE
       endif
  end

 Picture  MouseMouse
    if bLoad = TRUE then
      Picture.picture = LoadPicture(<name of BMP when passing over>)
      bLoad = FALSE
    endif
  end

You can, as Jim said, use the index propertie to control an array of
pictures. The most important is to use any flag that controls the right
loading of images in the picture, and to create a way to assure the
Form.MouseMove event, as sometimes, when moving the mouse very fast, it
doesn't happen and the picture control will remain with the image of the
mouse move event.

Yours,

        Mauricio Fiss.

Quote:
> Chaps,

> VB4 does not have a MOUSEOVER event, at least as far as I can tell it
> doesnt. What I want is to change the picture in an image control when
> the
> mouse moves over it, then back to its original picture when the mouse
> leaves. I know I can do this if a mouse button is pressed, however
> thats NOT
> what I am after - just a mouse, wandering around the screen with no
> buttons
> down, with images changing as the mouse moves over the image controls
> - any
> thoughts ?

> Rob.


> http://www.stonecold.co.uk

--
      -= Mauricio Fiss =-
 Mister CD-ROM & Raven Multimedia
___________________________________

Tel.   : (011) 744-4155
web    : http://www.ravenbrasil.com


Sun, 02 Jul 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Query vs. Dynaset in VB4.0 32bit

2. Upgrade Problems: VB4.0/16Bit to VB4.0/32Bit

3. VB4 16bit Vs. VB4 32bit???

4. Will Wordpad work will in vb4 32bit?

5. Using CreateProcess or ShellExecute (VB4-32Bit)

6. VB4.0EE 32bit Error writing EXE w/Rmt Supt files

7. Out of Stack 28 using VB4-32bit with Office 97 Installed

8. Connecting 2 Win95 PC via VB4 32bit?

9. Help on Update in VB4 32bit please

10. Btrieve & 32bit VB4

11. 16bit ODBC in VB4.0 (32bit)

12. VB4-32bit/Win95 Oracle ODBC problems.

 

 
Powered by phpBB® Forum Software