Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

button behaviour

Status
Not open for further replies.

AlastairP

Technical User
Feb 8, 2011
286
AU
I have some command buttons set to hot tracking
When clicking a button it shows it as depressed
After click event it shows as raised
I am wondering if there is a way a command button can return to non clicked state (not raised) when mouse leave event in button is triggered?
 
Not sure what you mean "after click event". In general, a hot-tracked button should return to its normal state after the button loses focus. Would setting focus to another control create the desired effect?

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Yes that works,however, as I build my button class I would need some reuseable code or method.

"After click event it shows as raised"

What I meant to say was:
When clicking the button with the mouse, it first shows depressed, when the mouse button is released it shows raised, then when the mouse leaves the button stays raised.


I will experiment and report back for reference.
 
Hot tracking is what it is. It always shows the last button clicked. I don't know any way to turn that off.
 
Alastair,

The raised effect doesn't indicate that the button has been clicked, but rather that the button has focus. It will stay raised until something else gets focus. That's how it works.

Personally, I wouldn't try to change it. What you've got is the standard Windows behaviour.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Just a follow up:

For some reason, I get the behaviour I am after when the command buttons are located on a toolbar.
So I have added a side docked (and locked in postion) toolbar.
I have implemented a forms manager to disable the command buttons and refresh the toolbar when form closed.

 
So you found a different implementation of what Mike said about buttons having focus. Toolbars never get focus.
 
Looks like you'd also get the behaviour you want using normal buttons without hottracking enabled. Or I don't get what you really are after.

Bye, Olaf.
 
Olaf,
- normal buttons with hot tracking enabled do not reset to normal after click event (Unless focus is set to some other control)
- normal buttons in a tool bar reset after click event

I have the behaviour I am after with hot tracking, if I use a toolbar


Alastair
 
Alastair,

The point about toolbars is that they never receive focus. So toolbar buttons always appear the same, whether or not you have just clicked on them.

If you really want your other buttons (other than toolbar buttons) to behave that way, your only option is to create your own button class, perhaps based on an image. You would need two pictures, one for the normal button and one for the hot-tracking effect. You would then switch between them in the appropriate mouse events.

But is it really worth worrying about? The existing behaviour is perfectly normal, and it's what users see in their other applications.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Well,

normal buttons without hot tracking enabled do reset to normal after click event, so why are you using hot tracking at all?

Bye, Olaf.
 
Thanks,
I am only using the hot tracking buttons in certain locations, such as top of forms as a tool bar.

I have created a container class with hot tracking buttons, which has some code in each button to send the focus to a dummy hidden control.
This works well.

This is the style that the owner of the business has asked for ...

Alastair
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top