Page 1 of 1

Capture Enter Key

Posted: Mon Dec 03, 2007 11:12 pm
by mmurdock
I use forms to allow users to enter in filters for a report. When the user clicks on my OK button it then runs the report. I would like to have so that if a user presses there Enter key it will act as if the OK button was pressed. Right now if they press Enter it runs my report but does not run my script that is tied to the OK button. I have set the ok button to be the default button. I think it only ignores this when a textbox has focus. Any help with this would be appreciated.

Mat

Capture Enter Key

Posted: Tue Dec 04, 2007 2:47 am
by Brendan
I set my "OK" buttons to [Default = True, Cancel = False, DialogResult = OK] and "Cancel" button to [Default = False, Cancel = True, DialogResult = Cancel]
But you say you've already set Default to true? Maybe there's two buttons with default set to true?

Capture Enter Key

Posted: Tue Dec 04, 2007 5:55 pm
by mmurdock
I have it set exactly as you have yours. It seems to ignore the Default=true when your cursor is in a text box.

Mat

Capture Enter Key

Posted: Tue Dec 04, 2007 6:01 pm
by Brendan
It's not a multi line textbox no?

Capture Enter Key

Posted: Wed Dec 05, 2007 2:45 am
by Edward
We've found the following inaccuracy:

When you press the "Enter" key, the Text property of the TextBox component remains unchanged and the Click event Handler is called with its previous value. We will correct this value in the next prerelease build.

But "Click" Event Handler for "OK" button is always called.

Thank you.

Capture Enter Key

Posted: Wed Dec 05, 2007 9:57 am
by mmurdock
I have the text box set to not accept returns and it is not a multiline box either.

Thanks for looking into this.

Mat