Page 1 of 1

Strange TButton behavior with VK_RETURN

Posted: Mon Apr 28, 2008 11:41 pm
by Stevemcg
I have a problem trying to figure out why a TButton control on a dialog does not respond to the Enter/Return keypress as I would expect whenever the button has focus. As I move from one TGet control to the next using the Enter/Return key, I eventually land on the TButton control, but pressing Enter/Return again acts like a VK_TAB and moves to the next control without firing the bAction. If I tab backwards to the TButton control, it does work the way I would expect (fires the bAction when Enter/Return is pressed). I've tried removing all the customized code I could to narrow down the possibilities, but can't figure out where to trap the VK_RETURN keypress inside the TButton code. What am I doing wrong?

- Steve

FiveWin v1.9.5

Posted: Tue Apr 29, 2008 12:17 am
by Antonio Linares
Steve,

You are using a very old FiveWin version. You should upgrade it. There have been lots of changes and enhancements in these past years. You can order the upgrade from www.fivetechsoft.com purchase section.

In the meantime, could you provide a small PRG sample to reproduce it ?

Posted: Wed Apr 30, 2008 1:01 am
by James Bott
Steve,

Let me point out that using the Enter key to move from control to control is old DOS behavior and is not standard Windows behavior. The Tab key is standard Windows application behavior to move from control to control. The Return key is supposed to trigger the OK button regardless of which control you are on. This is so the user can exit the dialog without moving through all the controls previous to the OK button (and without using the mouse).

In Resource Workshop the OK button is automatically defined with an ID of 1 and the "Default Pushbutton" checkbox is checked.

Thus, solving your problem only succeeds in making your application act like an old DOS application and this is not what users expect, so they will probably not be happy.

Regards,
James

Posted: Wed Apr 30, 2008 3:47 am
by Stevemcg
James -

You raise a very valid point about the Return key being a throwback to the old DOS days... and ironically that was what I was originally trying to achieve. This particular application evolved from and old DOS app and I was trying to keep the keystroke routine similar to what the users were accustomed to. In fact, I thought perhaps my efforts towards that goal may have been the reason... but I guess that it's just doing what it's supposed to despite my efforts. What puzzled me was why the Return key works when you Back-Tab to that button. I'll go back and review with the users and see if tabbing through the gets/controls is acceptable to them and stick with Windows convention.

Anotonio -

Sorry that I haven't had a chance to produce a small sample program. After Jame's advice, I wonder if it's even worth pursuing. I realize I'm way behind the curve with my version of FiveWin (it's a long story), and I do have plans to upgrade so that I can get answers to questions without being embarassed. But at the moment, the time I would need to convert the application would adversely affect the delivery schedule... so I'll have to make do for the time being. Once I get this version of the application squared away, I will get back to you about the upgrade.

Thanks to both of you for responding to my problem.

- Steve

Posted: Wed Apr 30, 2008 4:27 am
by James Bott
Steve,

I have been there, done that. Don't ask the users. Sometimes you just have to do what is best.

Don't forget that the users don't use just your app. All other Windows apps use the Tab key. The users may complain for a few days, but that will be the end of it. That has been my experience.

You can always tell them that it can't be done. Tell them it is a windows thing.

Users are not the best people to design interfaces. Unfortunately, most programmers often are not the best designers either. I highly recommend getting a copy of Alan Cooper's book, "About Face 2.0, The Essentials of Interaction Design." You can find more about it and a link to Amazon's page on my website here:

http://ourworld.compuserve.com/homepage ... rogram.htm

As of today you can get a used copy for $4.24. You won't realize how valuable this book is until you have it.

I think you will find conversion to 32bit FW/Harbour much easier than you think. I expect a day for setup and another day or two to fix any problems, or you may have none. And problems you may be having with the Clipper version may all be gone. You can gets lots of help here on the forum.

James