No announcement yet.

STANDARD scrollbar and cursor keys

  • Filter
  • Time
  • Show
Clear All
new posts

  • STANDARD scrollbar and cursor keys

    The HELP below (from the Windows Win32 Programmers' Reference) does not appear to be true, unless there is some prerequisite window style or exstyle or whatever required.

    Perhaps, as in my case, the dialog is a modeless one, created with DIALOG NEW (not CREATEWINDOWex) as --

    Style = %WS_POPUP Or _
    %WS_BORDER Or _
    %SS_NOTIFY Or _

    Dialog New hDlg&, "", 10, 40, 404, 217, Style To qcDlg& 'Scrolling window

    -- and perhaps there is a problem with that. The question of a "message pump" as referred to by Lance: in sample Address.bas, a DIALOG DOEVENTS occurs only in a button callback function; in the dialog callback is the code I would expect, a case structure to trap CbMsg and sublevels within that where required.

    In my code the CbMsg case for %WM_VSCROLL works as expected in the callback routine of the dialog, but the case for %WM_KEYDOWN (or %WM_KEYUP) does not even trap the CbMsg for any of the cursor keys. Does anyone know more?
    Creating a Keyboard Interface for a Standard Scroll Bar

    Although a scroll bar control provides a built-in keyboard interface, a standard scroll bar does not. To implement a keyboard interface for a standard scroll bar, a window procedure must process the WM_KEYDOWN message and examine the virtual-key code specified by the wParam parameter. If the virtual-key code corresponds to an arrow key, the window procedure sends itself a WM_HSCROLL or WM_VSCROLL message with the low-order word of the wParam parameter set to the appropriate scroll bar notification message. For example, when the user presses the UP arrow key, the window procedure receives a WM_KEYDOWN message with wParam equal to VK_UP. In response, the window procedure sends itself a WM_VSCROLL message with the low-order word of wParam set to the SB_LINEUP notification message.

    The following example shows how to include a keyboard interface for a standard scroll bar.
    (etc. - there follows the promised example, in some foreign language - possibly C)

  • #2
    First, why are you using a "static control style" in your DDT style? (%SS_NOTIFY) This is not the "correct" way to specify a dialog style.

    Second, DDT hides some of the normal messages that a conventional SDK-style callback would receive. You'll need to subclass the dialog (and possible any child controls used on the dialog) in order to intercept keyboard messages.

    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    mailto:[email protected]