home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4708 < prev    next >
Encoding:
Text File  |  1993-01-07  |  2.4 KB  |  60 lines

  1. Path: sparky!uunet!gatech!concert!bdrc!jcl
  2. From: jcl@bdrc.bd.com (John C. Lusth)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: moving the input focus
  5. Message-ID: <1851@bdrc.bdrc.bd.com>
  6. Date: 7 Jan 93 20:25:25 GMT
  7. Sender: news@bdrc.bdrc.bd.com
  8. Lines: 49
  9. Nntp-Posting-Host: otis.bdrc.bd.com
  10.  
  11. Hi there!
  12.  
  13. I just finished rewriting Petzold's COLORS2 program in Programming Windows
  14. 3.1 in the style of his HEXCALC example in the same book.  Basically,
  15. my main window is a dialog box with three scrollbar controls and a
  16. static area upon which I paint the current color as defined by the
  17. scrollbar positions.  Now in his book, Petzold states that by including
  18. the WS_TABSTOP windows style for your dialog controls, Windows automatically
  19. will handle switching the input focus upon receiving a tab or shift-tab
  20. from the keyboard.  Well, it doesn't work.  Tab and shift-tab are ignored
  21. in my program.  If I take out the WS_TABSTOP style, then the keyboard
  22. interface for the scrollbars disappears (e.g. PgUp and PgDown don't work),
  23. so the WS_TABSTOP is doing something.
  24.  
  25. How do I fix this problem?  In HEXCALC, Petzold takes about keeping the
  26. buttons from getting the input focus. My scrollbars can get the focus
  27. when clicked upon, they just can't give it up without a mouse click on
  28. another scrollbar.
  29.  
  30. Here is my resource file...
  31.  
  32. #include <windows.h>
  33.  
  34. #define SBS_VERT_TAB (SBS_VERT | WS_TABSTOP)
  35.  
  36. ColorMaker DIALOG 8, 16, 256, 128
  37.     STYLE WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX 
  38.     CLASS "ColorMaker"
  39.     CAPTION "Color Maker"
  40.     {
  41.     CONTROL "&Red",   -1, "static",   SS_CENTER,      10,   4,  24,   8
  42.     CONTROL "",       10, "scrollbar" SBS_VERT_TAB,   14,  16,  16,  92 
  43.     CONTROL "0",      13, "static",   SS_CENTER,      10, 112,  24,   8
  44.     CONTROL "&Green", -1, "static",   SS_CENTER,      50,   4,  24,   8
  45.     CONTROL "",       11, "scrollbar" SBS_VERT_TAB,   54,  16,  16,  92 
  46.     CONTROL "0",      14, "static",   SS_CENTER,      50, 112,  24,   8
  47.     CONTROL "&Blue",  -1, "static",   SS_CENTER,      90,   4,  24,   8
  48.     CONTROL "",       12, "scrollbar" SBS_VERT_TAB,   94,  16,  16,  92 
  49.     CONTROL "0",      15, "static",   SS_CENTER,      90, 112,  24,   8
  50.     CONTROL "",       20, "static",   WS_BORDER | SS_CENTER,    
  51.         138,   4, 114, 120
  52.     }
  53.  
  54.  
  55. Any help would be appreciated.
  56.  
  57. john
  58. -- 
  59. John C. Lusth, Becton Dickinson Research Center, RTP, NC, USA  jcl@bdrc.bd.com
  60.