Strange TButton behavior with VK_RETURN

Strange TButton behavior with VK_RETURN

Postby Stevemcg » Mon Apr 28, 2008 11:41 pm

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
Stevemcg
 
Posts: 8
Joined: Thu Apr 03, 2008 10:17 pm

Postby Antonio Linares » Tue Apr 29, 2008 12:17 am

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 ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41208
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Wed Apr 30, 2008 1:01 am

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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Stevemcg » Wed Apr 30, 2008 3:47 am

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
Stevemcg
 
Posts: 8
Joined: Thu Apr 03, 2008 10:17 pm

Postby James Bott » Wed Apr 30, 2008 4:27 am

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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 5 guests