Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can the background colour of the command button change
Message
 
To
25/08/2001 19:21:34
Christopher Pinnock
United General Insurance Company
Kingston, Jamaica
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00549193
Message ID:
00549204
Views:
16
in VFP 7 there is are two new propertities for Command Buttons / labels and shapes. Mouse enter Event and Mouse Exit Event. You can put code in these events, to change the caption color of command button, however, chaning the the button itself is... at least for me has been a bit tricky.

seems like Microsoft does not think changing the colors of buttons is really a good idea... making the colors of buttons always the windows button colors.

but Like you, I dont care for the standard grey, or whatever the user has set for their display propertites. I needed more control over the colors, than was immedatialy visible.

My solution ended up being making a container object, with Three controls
1 a shape - opeque background color - which I set- curvature and all.
2 a command button, with style set to 1. invisible. and special effect set to 2 hot tracking.
The width and height of the button, was set to match whatever the width and height of the shape was.
the shape width and heigh was set to whatever the container object was. so sizing the conainer, sized everthing. and so on.

3 a label object, sitting on top of the invisible command button, which in the click event did something like
this.parent._commandbutton1.click()
and the commandbutton.caption was set to this.parent._label1.caption.
So I would set the caption on the label, with hot key assignment, and the hot key function would work for the button underneith... I had to do this becuase then the user could tab to the invisible button.

then in the mouse over event of the lable, or shape, I would change the color slightly to indicate to the user their mouse was over the control.

Save it as a class. and you could then use it.


With VFP 6. the only thing I couldnt seem to control as well was the mouse enter, and mouse leave event. There is a mouse move, event. but that was quite hard to tell when someone moved off a control etc..

I truly hope that someone has come up with somthing simplier than this - convoluted method, to get something as colored butons. But thats what I did.

Bob Lee


>Hey guys, I need my buttons to have a webby kinda look and feel. Can I change the back colour of the command button in VFP 6.0. If not I would like to write a very simple one. Any ideas ???
>
>Problems in writing one for myself:
>1. How do i know when the mouse has left my control without putting code on the control that i would eventually put my button (much like how windows does it) ??? I want to change the look of the button when the mouse passes over and reset it when the mouse leaves.
>
>
>Please send me your ideas.
>
>
>Chris
In the beginning, there was a command prompt, and all was well.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform