SetFocus.. Where am I going wrong

Started by Martin Francom, March 17, 2010, 07:55:33 PM

Previous topic - Next topic

Roger Garstang

Quote from: John Montenigro on March 29, 2010, 10:26:14 AM
For example:
- If you want to load a form and have a particular command button be the default and have focus (to ignore what the user types and only accept Enter), then do these things...(show code)
- If you want to load a form and have a textbox receive keystrokes while a command button receives Enter, then do these things...(show code)
...
Ex1- Set style of button to BS_DEFPUSHBUTTON and put it first in Tab Order, then it will get focus and Default status. Space/Enter will then click button.
Ex2- Set style of button to BS_DEFPUSHBUTTON and put textbox first in Tab Order.

Those two should work fine.  The only things not working to M$ standard found in this thread is a Non-Default Button First in Tab Order should get Default State, and Multiline Text Boxes/RichEdit tabbing to a Button not giving it a Default highlight either (Thought it was more, but appears to just be that).  I think Paul can mix my last code with his tweak allowing tabbing from Multiline Textboxes to give the buttons the highlight. And, the last half of whatever he makes to apply to RichEdit since they allow tabbing out without the tweak, but still don't give the highlight.