PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: James Padgett on October 20, 2011, 11:06:43 PM

Title: Program a button press ?
Post by: James Padgett on October 20, 2011, 11:06:43 PM
How do you program a button push ?

I want to programatically determine when the Enter key is pressed in a text box and then activate the command button.
I have a 2nd form with 2 text boxes one a user name the other a password and want the ' OK ' ( command button ) pressed if the enter key is pressed from within the 2nd text box..

My thoughts are to get the text for each EN_CHANGE event and then if 'return' key detected send the event for pressing the command button..

Am I on the right track ?
Title: Re: Program a button press ?
Post by: Brian Chirgwin on October 21, 2011, 12:17:46 AM
On the button properties set the OK button to default.

Under Windows Style of the button set it to BS_DEFPUSHBUTTON
If your text box takes allows returns then the default button won't be clicked when pressing enter.

If you have a cancel button set the property Cancel to true. This is just below the Windows Style property.
By setting this property to true Esc key will be the same as clicking the cancel button.


Title: Re: Program a button press ?
Post by: James Padgett on October 23, 2011, 08:44:05 AM
That was easy ....  set it to BS_DEFPUSHBUTTON