How to stop button from retaining focus?

How to stop button from retaining focus?

Post by Tom We » Fri, 14 Apr 2000 04:00:00



My application (written in C) has a bunch of text buttons above a
text entry area.  I want the focus to remain with the text area.  
If a user presses a text button, the generated WM_COMMAND in the
parent window returns the focus back to the text area.  

However, if the user presses on a text button, slides the mouse
off the button and then releases the mouse button, the button gets
focus but doesn't send any message to the parent window and the
text button retains the focus, causing the users typing to be ignored
until they accidentally hit space...

Merely returning the focus to the text area whenever it loses it stops
the tex buttons from ever firing!

Does anyone have any solution to preventing a regular button from
retaining focus?

                                        Tom West
-----------------------------------------------------------------------------

Technical Support Manager       |  Phone : (416) 978-8363
Holt Software Associates Inc.   |  Fax   : (416) 978-1509
-----------------------------------------------------------------------------

 
 
 

How to stop button from retaining focus?

Post by Dave Cryde » Sat, 15 Apr 2000 04:00:00




Quote:> My application (written in C) has a bunch of text buttons above a
> text entry area.  I want the focus to remain with the text area.
> If a user presses a text button, the generated WM_COMMAND in the
> parent window returns the focus back to the text area.

> However, if the user presses on a text button, slides the mouse
> off the button and then releases the mouse button, the button gets
> focus but doesn't send any message to the parent window and the
> text button retains the focus, causing the users typing to be ignored
> until they accidentally hit space...

> Merely returning the focus to the text area whenever it loses it stops
> the tex buttons from ever firing!

> Does anyone have any solution to preventing a regular button from
> retaining focus?

You could capture the WM_MOUSEMOVE message and check to see if the
cursor is in any of the buttons.  If not, return the focus to the text
area.  It's not elegant - but it works (in VC++ anyway).

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

1. How to Stop Button Retaining Focus?

My appliction (written in C) has a bunch of text buttons above a
text entry area.  I want the focus to remain with the text area.  
If a user presses a text button, the generated WM_COMMAND in the
parent window returns the focus back to the text area.  

However, if the user presses on a text button, slides the mouse
off the button and then releases the mouse button, the button gets
focus but doesn't send any message to the parent window and the
text button retains the focus, causing the users typing to be ignored
until they accidentally hit space...

Merely returning the focus to the text area whenever it loses it stops
the tex buttons from ever firing!

Does anyone have any solution to preventing a regular button from
retaining focus?

2. A500 keyboard problem

3. retain or not retain on init?

4. dlt7000

5. Toolbar Buttons do not retain their color.

6. EOB 1 Help - pleeeease !

7. Retaining information on form after clicking the back button on Internet Explorer 6

8. PW Question: Define Scenery

9. Popup window steals owner's focus -- make it stop

10. How to stop the caret from hiding when window looses focus?

11. Button focus question

12. Disabled OK button still has "focus"

13. Button's focus rectangle