Don't want ENTER to push button

Don't want ENTER to push button

Postby Ollie » Tue Jan 09, 2007 2: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)
Ollie
 
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Postby areang » Tue Jan 09, 2007 2: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
areang
 
Posts: 128
Joined: Mon Jul 31, 2006 3:23 pm

Postby Gale FORd » Tue Jan 09, 2007 3: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.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Postby Ollie » Tue Jan 09, 2007 3: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?

Code: Select all  Expand view
   
   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)
Ollie
 
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Postby Gale FORd » Tue Jan 09, 2007 4: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
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

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

Postby Ollie » Tue Jan 09, 2007 9: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)
Ollie
 
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Postby James Bott » Tue Jan 09, 2007 9: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]
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Detlef Hoefner » Wed Jan 10, 2007 8: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?

Code: Select all  Expand view
   
   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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Ollie » 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)
Ollie
 
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Postby Gale FORd » Wed Jan 10, 2007 3:26 pm

I forgot about id 1. I quit using that id so long ago.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Postby Ollie » Thu Jan 11, 2007 6: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)
Ollie
 
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 78 guests