FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Don't want ENTER to push button
Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
Don't want ENTER to push button
Posted: Tue Jan 09, 2007 02:05 PM

I have a dialog with a bunch of GETS, I want the user to press Enter through the fields as he enters them.

When I press enter, it presses the 'Save' button. How can I make it not do that, forcing the user to Click "Save" when he is ready.

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 128
Joined: Mon Jul 31, 2006 03:23 PM
Don't want ENTER to push button
Posted: Tue Jan 09, 2007 02:12 PM

Mr. Ollie

when user clicked "Save" button then action for MySave()

function MySave()
if MsgYesNo("Are you sure ?")
/
put here for save your variable
/
endif
return nil

Regards
Areang

Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Don't want ENTER to push button
Posted: Tue Jan 09, 2007 03:23 PM

It sounds like your "Save" button has been set to default. If you remove the default setting then the enter key will take you to the next field instead of pressing the default button.

Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
Don't want ENTER to push button
Posted: Tue Jan 09, 2007 03:47 PM
It hasn't been set to default. As far as I know. (There is no DEFAULT clause in the button definition How do I set default off?

   
   REDEFINE BTNBMP oBtn_Save ID IDOK of Dlg_SUB PROMPT "Save" TOP RESOURCE "save" ACTION ( Update_dbmain(), Dlg_SUB:END() ) TOOLTIP "Save"
   REDEFINE BTNBMP oBtn_Cancel ID IDCANCEL of Dlg_SUB PROMPT "Cancel" TOP RESOURCE "cancel" ACTION ( oDBF_MAIN:Load(), Dlg_Dbmain:Update(),  Dlg_SUB:END() ) TOOLTIP "Cancel"
Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Don't want ENTER to push button
Posted: Tue Jan 09, 2007 04:35 PM

Check the resource. In a resource editor or in the .rc

CONTROL "OK", 1, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 4, 49, 40, 14

change BS_DEFPUSHBUTTON to BS_PUSHBUTTON

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Don't want ENTER to push button
Posted: Tue Jan 09, 2007 07:30 PM

Ollie,

>I have a dialog with a bunch of GETS, I want the user to press Enter through the fields as he enters them.

This is DOS behavior not Windows behavoir. Most users will expect the Tab key to move between fields, and the Enter key to push the default button. Having the Enter key work this way prevents them from having to use the mouse to press the button.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
Don't want ENTER to push button
Posted: Tue Jan 09, 2007 09:42 PM

Ok, I accept that. Is there a way for the TAB key to jump to the next TAB/Folder or does one need to use the mouse to change TABS.

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Don't want ENTER to push button
Posted: Tue Jan 09, 2007 09:57 PM

Ollie,

>Is there a way for the TAB key to jump to the next TAB/Folder or does one need to use the mouse to change TABS.

Well, you can't have the Tab key jump to the next control AND jump to the next folder. If you define a hot-key in the folder name (e.g. "&Orders" ) then the user can use Alt-O to jump to the next folder.

I think you would get a lot ouf of reading the book, "About Face 2.0, The Essentials of Interaction Design," by Alan Cooper and Robert M. Reimann. This is a teriffic book about Windows application interface design. You can find out more about it on my website on this page:

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

James [/quote]

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Don't want ENTER to push button
Posted: Wed Jan 10, 2007 08:48 AM
Ollie wrote:It hasn't been set to default. As far as I know. (There is no DEFAULT clause in the button definition How do I set default off?

   
   REDEFINE BTNBMP oBtn_Save ID IDOK of Dlg_SUB PROMPT "Save" TOP RESOURCE "save" ACTION ( Update_dbmain(), Dlg_SUB:END() ) TOOLTIP "Save"
   REDEFINE BTNBMP oBtn_Cancel ID IDCANCEL of Dlg_SUB PROMPT "Cancel" TOP RESOURCE "cancel" ACTION ( oDBF_MAIN:Load(), Dlg_Dbmain:Update(),  Dlg_SUB:END() ) TOOLTIP "Cancel"


Ollie,

a redefine-ID of 1 or 2 ( IDOK or IDCANCEL ) will give your button the default behaviour when pressing the enter key.

Maybe that helps,
Detlef
Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
Don't want ENTER to push button
Posted: Wed Jan 10, 2007 12:41 PM

Detlef,

I could set ID to 1, and 2, but set to 10 and 20, and, I don't know why, but it worked!

Thanks

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Don't want ENTER to push button
Posted: Wed Jan 10, 2007 03:26 PM

I forgot about id 1. I quit using that id so long ago.

Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
Don't want ENTER to push button
Posted: Thu Jan 11, 2007 06:49 AM

Sorry - typo- I meant to say I could NOT set the ID to 1. Using Pelles C - it reverts to 10 all the time. Anyway it all worked - thanks everyone.

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)

Continue the discussion