MouseMove and "coolbars"

MouseMove and "coolbars"

Post by MAppell9 » Sat, 22 May 1999 04:00:00



I'm not sure if I'm correctly using the term "coolbar."  Anway, I'd like to
find a way to place a shape around an object when the mouse cursor is placed
over it.  MouseMove does this just find.  The problem arises when the user
moves the mouse cursor off the object.  How can I detect for this?

Is there an event that checks for this (kind of like a lost focus but call it
lost mousecursor or somthing instead)?  I'd like to do this in certain places
in my application (in forms and toolbars).  At first, I thought maybe I could
have all the objects on the form or toolbar call a method.  The method would
store the last object that was highlighted.  The method could then clear the
last highlighted object's button and highlight the current one.  This worked
well until I found my mouse cursor on the form (where the mouse cursor was not
over any object).  That's where the problem was; the object was still
highlighted.

Any clues?  Thanks again for all the help.

Mike

 
 
 

MouseMove and "coolbars"

Post by Geoff Daviso » Sat, 22 May 1999 04:00:00


Not sure if this will help but I would read up on the Drag, DragOver and
DragDrop events.  They ,might be just waht you are after.


Quote:>I'm not sure if I'm correctly using the term "coolbar."  Anway, I'd like to
>find a way to place a shape around an object when the mouse cursor is
placed
>over it.  MouseMove does this just find.  The problem arises when the user
>moves the mouse cursor off the object.  How can I detect for this?

>Is there an event that checks for this (kind of like a lost focus but call
it
>lost mousecursor or somthing instead)?  I'd like to do this in certain
places
>in my application (in forms and toolbars).  At first, I thought maybe I
could
>have all the objects on the form or toolbar call a method.  The method
would
>store the last object that was highlighted.  The method could then clear
the
>last highlighted object's button and highlight the current one.  This
worked
>well until I found my mouse cursor on the form (where the mouse cursor was
not
>over any object).  That's where the problem was; the object was still
>highlighted.

>Any clues?  Thanks again for all the help.

>Mike


 
 
 

MouseMove and "coolbars"

Post by Mike Welbor » Sat, 22 May 1999 04:00:00


Why not add code to the MouseMove method of the form to clear the last
object's button?

Mike


Quote:> I'm not sure if I'm correctly using the term "coolbar."  Anway, I'd like
to
> find a way to place a shape around an object when the mouse cursor is
placed
> over it.  MouseMove does this just find.  The problem arises when the user
> moves the mouse cursor off the object.  How can I detect for this?

> Is there an event that checks for this (kind of like a lost focus but call
it
> lost mousecursor or somthing instead)?  I'd like to do this in certain
places
> in my application (in forms and toolbars).  At first, I thought maybe I
could
> have all the objects on the form or toolbar call a method.  The method
would
> store the last object that was highlighted.  The method could then clear
the
> last highlighted object's button and highlight the current one.  This
worked
> well until I found my mouse cursor on the form (where the mouse cursor was
not
> over any object).  That's where the problem was; the object was still
> highlighted.

> Any clues?  Thanks again for all the help.

> Mike

 
 
 

MouseMove and "coolbars"

Post by Tim Witor » Sat, 22 May 1999 04:00:00


I have some classes that do this.  I adapted them from
someone else's classes that came close.  The class that
works on forms is very solid.  The class that works on
toolbars I have not worked on lately, but it is close
to working (I think).

I've also seen an even simpler implementation (don't
recall where), but it required that one object on the
form always be hilighted.

If you're interested in the classes I have, let me
know.

-- TRW


> I'm not sure if I'm correctly using the term "coolbar."  Anway, I'd like to
> find a way to place a shape around an object when the mouse cursor is placed
> over it.  MouseMove does this just find.  The problem arises when the user
> moves the mouse cursor off the object.  How can I detect for this?

> Is there an event that checks for this (kind of like a lost focus but call it
> lost mousecursor or somthing instead)?  I'd like to do this in certain places
> in my application (in forms and toolbars).  At first, I thought maybe I could
> have all the objects on the form or toolbar call a method.  The method would
> store the last object that was highlighted.  The method could then clear the
> last highlighted object's button and highlight the current one.  This worked
> well until I found my mouse cursor on the form (where the mouse cursor was not
> over any object).  That's where the problem was; the object was still
> highlighted.

> Any clues?  Thanks again for all the help.

> Mike

--

--------------------------------------
Remove the "drop this" strings from my
e-mail address to reply.
--------------------------------------

 
 
 

MouseMove and "coolbars"

Post by MAppell9 » Sun, 23 May 1999 04:00:00


Quote:

>Why not add code to the MouseMove method of the form to clear the last
>object's button?

Mike
 
 
 

MouseMove and "coolbars"

Post by MAppell9 » Sun, 23 May 1999 04:00:00


TRW,

I'd like to see the code.  I can't seem to figure out the code in the solutions
pack.

In respones to reply #3, you can't just add code to the MouseMove method to
clear the last object's button.  I tried that.  The problem is that MouseMove
only gets executed when you place the mouse cursor over an object.  You do that
and clear the last object and highlight the current one.  Then suppose you move
your mouse cursor on the form but not over an object.  Now the object stays
highlighted.  That's the problem.  There's a cancelhighlight method in the
solutions pack and I have no idea where it's being called from.  I can't seem
to figure out a way to cancel the highlight.  I can cancel it when they move
the mousecursor over another object but the problem is what if they just move
the mouse cursor over some other part of the form?  I'm going to have to think
of some trick to incorporate this.

I looked at drag and drop methods.  I don't think that's going to work either
or if I did that it would be a lot of coding.  I'll look at it some more but I
sure wish someone would give me a simple solution for this procedure.

Quote:

>Why not add code to the MouseMove method of the form to clear the last
>object's button?

>I have some classes that do this.  I adapted them from
>someone else's classes that came close.  The class that
>works on forms is very solid.  The class that works on
>toolbars I have not worked on lately, but it is close
>to working (I think).

>I've also seen an even simpler implementation (don't
>recall where), but it required that one object on the
>form always be hilighted.

>If you're interested in the classes I have, let me
>know.

>-- TRW

Mike
 
 
 

MouseMove and "coolbars"

Post by Anders Altber » Sun, 23 May 1999 04:00:00


There's a class called _mouseoverfx in _ui.vcx among the FFC libraries in
VFP 6.0. Check it out.
-Anders


Quote:> I'm not sure if I'm correctly using the term "coolbar."  Anway, I'd like
to
> find a way to place a shape around an object when the mouse cursor is
placed
> over it.  MouseMove does this just find.  The problem arises when the user
> moves the mouse cursor off the object.  How can I detect for this?

> Is there an event that checks for this (kind of like a lost focus but call
it
> lost mousecursor or somthing instead)?  I'd like to do this in certain
places
> in my application (in forms and toolbars).  At first, I thought maybe I
could
> have all the objects on the form or toolbar call a method.  The method
would
> store the last object that was highlighted.  The method could then clear
the
> last highlighted object's button and highlight the current one.  This
worked
> well until I found my mouse cursor on the form (where the mouse cursor was
not
> over any object).  That's where the problem was; the object was still
> highlighted.

> Any clues?  Thanks again for all the help.

> Mike

 
 
 

MouseMove and "coolbars"

Post by MAppell9 » Sun, 23 May 1999 04:00:00


Anders,

I did check out that class and that's just it.  I can't figure out how it's
clearing the coolbar after the mouse cursor is moved back on the screen.

Quote:

>There's a class called _mouseoverfx in _ui.vcx among the FFC libraries in
>VFP 6.0. Check it out.
>-Anders

Mike
 
 
 

MouseMove and "coolbars"

Post by Mike Welbor » Tue, 25 May 1999 04:00:00


I didn't get any reply so I don't know how you responded.

I know you tried code in object.MouseMove() event. My question was why not
also add code to Form.MouseMove(). When you move off of the object I assume
you are moving over the form. As such Form.MouseMove() shuld be firing?

Mike


Quote:

> >Why not add code to the MouseMove method of the form to clear the last
> >object's button?

> Mike

 
 
 

MouseMove and "coolbars"

Post by Tim Witor » Thu, 27 May 1999 04:00:00


That won't necessarily work (believe me I've
twiddled with this stuff quite a bit).  Objects'
mouseMove will only fire if the mouse is moved
over them within a threshold.  That is, if you
move the mouse quickly enough and the mouse is
not moving over the form when its location is
observed, it will not register.

Also, consider a not so uncommon case of a
control placed right next to the edge of the
form.  If the mouse moves off the control in
that direction, there may be no triggering of
the form's mouseMove.

In either of these cases, the control will
remain hilighted even though the mouse is
long gone.

The solution is a combination of mouseMove
code and a timer (and a few other little things).

-- TRW


> I didn't get any reply so I don't know how you responded.

> I know you tried code in object.MouseMove() event. My question was why not
> also add code to Form.MouseMove(). When you move off of the object I assume
> you are moving over the form. As such Form.MouseMove() shuld be firing?

> Mike



> > >Why not add code to the MouseMove method of the form to clear the last
> > >object's button?

> > Mike

--

--------------------------------------
Remove the "drop this" strings from my
e-mail address to reply.
--------------------------------------

 
 
 

MouseMove and "coolbars"

Post by MAppell9 » Fri, 28 May 1999 04:00:00


Well, I tried putting the mousemove event in my toolbar's base class and it
does work but sometimes it just doesn't.  I have a problem relying on other
objects to disable a particular object's state.

Does anyone know just how the coolbar is dealt with in the Solutions example?

It almost seems like it's just too much trouble and easier to hope for VFP 6.5
to do the task.

>That won't necessarily work (believe me I've
>twiddled with this stuff quite a bit).  Objects'
>mouseMove will only fire if the mouse is moved
>over them within a threshold.  That is, if you
>move the mouse quickly enough and the mouse is
>not moving over the form when its location is
>observed, it will not register.

>Also, consider a not so uncommon case of a
>control placed right next to the edge of the
>form.  If the mouse moves off the control in
>that direction, there may be no triggering of
>the form's mouseMove.

>In either of these cases, the control will
>remain hilighted even though the mouse is
>long gone.

>The solution is a combination of mouseMove
>code and a timer (and a few other little things).

>-- TRW


>> I didn't get any reply so I don't know how you responded.

>> I know you tried code in object.MouseMove() event. My question was why not
>> also add code to Form.MouseMove(). When you move off of the object I assume
>> you are moving over the form. As such Form.MouseMove() shuld be firing?

>> Mike



Mike
 
 
 

MouseMove and "coolbars"

Post by Tim Witor » Fri, 28 May 1999 04:00:00


Is the toolbar you are working on based on the toolbar
class?  If so, there are other things you must do in
order to hilight and un-hilight the controls on it
as the mouse moves over them.

Basically, a timer on the toolbar (which must be
added programatically, not visually, by the way)
keeps an object reference to the current control
under the mouse.  So in each control's mouse move,
the timer is told that this object has the mouse
over it in a custom method.  This method in the
timer then compares the object that is telling it
the mouse is over it to the last object that told
it this.  If they are different, the previous
object is unhilighted, the new object is hilighted,
the new object is made the current object that the
timer is tracking, and the timer is started.  
The timer's interval is about 50 ms.  When the timer
expires, it checks to see if the mouse is still
over the current control it is tracking.  If so,
the timer is reset.  If not, the current object is
unhilighted and the timer is turned off.

There are a few other details, but this approach
has worked very reliably for me.  I also looked at
the ActiveX coolbar options, but all of them
fell short for one reason or another.

If you want the complete code for this, let me know.

-- TRW


> Well, I tried putting the mousemove event in my toolbar's base class and it
> does work but sometimes it just doesn't.  I have a problem relying on other
> objects to disable a particular object's state.

> Does anyone know just how the coolbar is dealt with in the Solutions example?

> It almost seems like it's just too much trouble and easier to hope for VFP 6.5
> to do the task.

> >That won't necessarily work (believe me I've
> >twiddled with this stuff quite a bit).  Objects'
> >mouseMove will only fire if the mouse is moved
> >over them within a threshold.  That is, if you
> >move the mouse quickly enough and the mouse is
> >not moving over the form when its location is
> >observed, it will not register.

> >Also, consider a not so uncommon case of a
> >control placed right next to the edge of the
> >form.  If the mouse moves off the control in
> >that direction, there may be no triggering of
> >the form's mouseMove.

> >In either of these cases, the control will
> >remain hilighted even though the mouse is
> >long gone.

> >The solution is a combination of mouseMove
> >code and a timer (and a few other little things).

> >-- TRW


> >> I didn't get any reply so I don't know how you responded.

> >> I know you tried code in object.MouseMove() event. My question was why not
> >> also add code to Form.MouseMove(). When you move off of the object I assume
> >> you are moving over the form. As such Form.MouseMove() shuld be firing?

> >> Mike


> Mike

--

--------------------------------------
Remove the "drop this" strings from my
e-mail address to reply.
--------------------------------------