home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / mswindo / programm / tools / 699 < prev    next >
Encoding:
Text File  |  1992-08-12  |  1.5 KB  |  34 lines

  1. Newsgroups: comp.os.ms-windows.programmer.tools
  2. Path: sparky!uunet!microsoft!hexnut!blakeco
  3. From: blakeco@microsoft.com (Blake Coverett)
  4. Subject: Re: How do you replace <Tab> with <Enter> in a Dialog box?
  5. Message-ID: <1992Aug13.041410.22554@microsoft.com>
  6. Date: 13 Aug 92 04:14:10 GMT
  7. Organization: Microsoft Canada Inc.
  8. References: <59158ee7@cis.uab.edu> <190ad098@p11.f36.n245.z2.fidonet.org>
  9. Lines: 23
  10.  
  11. In article <190ad098@p11.f36.n245.z2.fidonet.org> Harald_Muehlhoff@softstream.fido.de (Harald Muehlhoff) writes:
  12. >when the user is pressing <Enter> in a dialog box your dialog procedure 
  13. >receives a WM_COMMAND message with IDOK in wParam.
  14. >Just add a check at the beginning of your code handling IDOK that verifies 
  15. >whether one of your edit controls still has the input focus. Then send your 
  16. >dialog procedure an appropriate message to set the input focus to another edit 
  17. >control.
  18.  
  19. This is not entirely correct.  The above will happen if you have no 
  20. currently "default" button in the dialog box.  If you do have a default
  21. button, it's ID will be sent in the WM_COMMAND message.
  22.  
  23. Probably the best way to enable <enter> to move to the next field is to
  24. install a WH_MSGFILTER hook (see SetWindowsHook[Ex]) and use the 
  25. WM_NEXTDLGCTL message.
  26.  
  27. As someone else already mentioned, this is however a poor thing to do
  28. from a consistancy point of view.  
  29.  
  30. -Blake
  31. -- 
  32. #include <std/disclaimer.h>                       blakeco@microsoft.com
  33. Mail Flames, Post Apologies.                      ...!uunet!microsoft!blakeco
  34.