🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #2567

moving the input focus

#2567
From: John C. Lusth
Date: Thu, 07 Jan 1993 20:25
49 lines
2487 bytes
Hi there!

I just finished rewriting Petzold's COLORS2 program in Programming Windows
3.1 in the style of his HEXCALC example in the same book.  Basically,
my main window is a dialog box with three scrollbar controls and a
static area upon which I paint the current color as defined by the
scrollbar positions.  Now in his book, Petzold states that by including
the WS_TABSTOP windows style for your dialog controls, Windows automatically
will handle switching the input focus upon receiving a tab or shift-tab
from the keyboard.  Well, it doesn't work.  Tab and shift-tab are ignored
in my program.  If I take out the WS_TABSTOP style, then the keyboard
interface for the scrollbars disappears (e.g. PgUp and PgDown don't work),
so the WS_TABSTOP is doing something.

How do I fix this problem?  In HEXCALC, Petzold takes about keeping the
buttons from getting the input focus. My scrollbars can get the focus
when clicked upon, they just can't give it up without a mouse click on
another scrollbar.

Here is my resource file...

#include <windows.h>

#define SBS_VERT_TAB (SBS_VERT | WS_TABSTOP)

ColorMaker DIALOG 8, 16, 256, 128
    STYLE WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX 
    CLASS "ColorMaker"
    CAPTION "Color Maker"
    {
    CONTROL "&Red",   -1, "static",   SS_CENTER,      10,   4,  24,   8
    CONTROL "",       10, "scrollbar" SBS_VERT_TAB,   14,  16,  16,  92 
    CONTROL "0",      13, "static",   SS_CENTER,      10, 112,  24,   8
    CONTROL "&Green", -1, "static",   SS_CENTER,      50,   4,  24,   8
    CONTROL "",       11, "scrollbar" SBS_VERT_TAB,   54,  16,  16,  92 
    CONTROL "0",      14, "static",   SS_CENTER,      50, 112,  24,   8
    CONTROL "&Blue",  -1, "static",   SS_CENTER,      90,   4,  24,   8
    CONTROL "",       12, "scrollbar" SBS_VERT_TAB,   94,  16,  16,  92 
    CONTROL "0",      15, "static",   SS_CENTER,      90, 112,  24,   8
    CONTROL "",       20, "static",   WS_BORDER | SS_CENTER,    
        138,   4, 114, 120
    }


Any help would be appreciated.

john
-- 
John C. Lusth, Becton Dickinson Research Center, RTP, NC, USA  jcl@bdrc.bd.com
Technical Details
Message-ID: <1851@bdrc.bdrc.bd.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!concert!bdrc!jcl

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!concert!bdrc!jcl
From: jcl@bdrc.bd.com (John C. Lusth)
Newsgroups: comp.os.ms-windows.programmer.misc
Subject: moving the input focus
Message-ID: <1851@bdrc.bdrc.bd.com>
Date: 7 Jan 93 20:25:25 GMT
Sender: news@bdrc.bdrc.bd.com
Lines: 49
Nntp-Posting-Host: otis.bdrc.bd.com