sorry was not clear enough have to update visual studio first. afxcontrolbar.h is not there.
I downloaded your example, compiled it and it gave on error on afx...h not avail.
regards,
ger
Printable View
sorry was not clear enough have to update visual studio first. afxcontrolbar.h is not there.
I downloaded your example, compiled it and it gave on error on afx...h not avail.
regards,
ger
What version of Visual Studio are you using? If it's the Express version, MFC isn't supported.
Arjay
I'm using Microsoft Visual Studio 2008 Pro Edition
Version 9.0.30729.1 SP
Loaded your hover project, THANKS!, worked super!
Made a new project called TEST, same style as your hover, worked super also.
Went back to my project, replace the bitmap button with a normal control button
(bitmap set to false) and quess what it worked.
Turned bitmap on again and owner draw to false
the project is still working (but at this time the bitmap is not visible, only the caption text)
Now the killer,
if i turn on bitmap and owner draw, both true. bitmap is visible.
but now the hotitemchange routine is not called.
so the change from standard button to bitmap button is the problem, i think ....
regards,
ger
Run the Spy++ tool and look at the styles for the button and compare them with the styles for the owner drawn button. There might be a style missing that you can add back (to get the hover message to fire).
Also, if you installed the MFC source code when you installed Visual C++, you can step into the MFC source code during button creation to try to figure out the issue.
I will put on my sherlock holmes goggles!
in the meantime I made a quick HOVER project for you, the fault is
in this project also, see att.
regards,
ger
Please let me know if the attached file(s) is/are working!
Spy++ Output:
Normal Button Styles:
WS_CHILDWINDOW
WS_VISIBLE
WS_TABSTOP
BS_PUSHBUTTON
BS_TEXT
extended styles:
WS_EX_LEFT
WS_EX_LTRREADING
WS_EX_RIGHTSCROLLBAR
WS_EX_NOPARENTNOTIFY
the bitmap button:
WS_CHILDWINDOW
WS_VISIBLE
WS_TABSTOP
BS_OWNERDRAW
BS_BITMAP
extended styles:
WS_EX_LEFT
WS_EX_LTRREADING
WS_EX_RIGHTSCROLLBAR
WS_EX_NOPARENTNOTIFY
regards,
ger
Arjay,
did you managed to download my sample?
regards,
ger
Yes. It doesn't look like hover works with owner draw.
You have to handle hover yourself with _TrackMouseEvent() and handle the WM_MOUSELEAVE message.
just an idea not sure that it will work but if you where to encapsulate the button in another class such as a view class and use the OnMouseMove or Hover message handler
Hi,
I was already afraid you guys would came up with that idea….
So can’t use HOTITEMCHANGE, will revert to mouse tracking
Did some field work;
Have to use: mouse-leave, mouse-move and mouse-hover
ON_WM_MOUSEMOVE()
ON_WM_MOUSELEAVE()
ON_WM_MOUSEHOVER()
Mouse-move will house the tracking event, correct?
Mouse-hover will change the bitmap to focus
And
Mouse-leave will change it to normal again.
So I need to create a new class, let’s call it HOT.
Which type/base should I use, when I start the add class wizard?
And
How do I clue the class to the button using this new HOT class,
(I think something like select control and right click, do the add option…)
Can I use the same class (Hot) on more than one button or do
I have to make a HOT1 and HOT2 and so on.
Regards,
Ger
I would use CView since it is simple and handles mouse messages and I would use it for one button if you want the action to happen just for that button and to glue it to the CView you make CView the base class
class mybutton : public CView
{ ...
...
That's an awful lot of overhead for a button.
In my opinion, you should just derive from CButton and make it owner draw and handle ALL the drawing yourself. Since CButton derives from CWnd, it has all the mouse handling capabilities without all the overhead of a CView.
Somewhere I have a whole CButton owner-draw class that I used in some project or other for toolbar buttons. It handles hover and all the other button stuff. I'll see if I can dig it up.
I haven't been following this thread too closely. What version of VS are you using?
yeah i know its alot of overhead but it was just an idea that i had along time ago to encapsilate the onmousemove action in an owner drawn button to change the bitmap,in which i had dropped the action for now and will work on it when I am doing clean up code on appearance so if you have something better I would like to know myself so please post to this thread what you were posting thanks hoxsiew
ver 6 introductory edition can't afford full version yet $900