Announcement

Collapse
No announcement yet.

MODELESS KB interface

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MODELESS KB interface

    I'm using Semen Matusovski's MODELESS dialog idea to trap
    keyboard events. It works well for all the additional functions
    I wanted to inplement, but it odesn't seem to allow the ability
    to throw away keystrokes.

    I can get the desired action with COMBOBOX's either with
    %CBS_DROPDOWN or %CBS_DROPDOWNLIST styles. With the former I
    also get the number keys being pressed appearing in the list
    box. But alphabet (and all others) appear too and I want to
    throw them away. Only numerics and ENTER are allowed. With a
    %CBS_DROPDOWNLIST stype All works but you don't get the
    intermediate keys appearing in the box.

    What I'd like to do is throw away the mesaages for all other
    keys. Would anyone have an opinion on things to try to
    infrom GetMessage that sometimes we don't want the message to
    be processed (e.g. FUNCTION=%TRUE in a CallBack Function).
    ------------------------------------------------------------
    DIALOG SHOW MODELESS hDlg, CALL CB_Main

    WHILE GetMessage(tMsg,%NULL,0,0)
    IF IsDialogMessage(hDlg,tMsg)=%FALSE THEN
    TranslateMessage tMsg
    DispatchMessage tMsg
    ELSE
    SELECT CASE tMsg.message
    CASE %WM_KEYUP
    SELECT CASE tMsg.WParam
    CASE 48 TO 57
    'Process the numeric keys
    CASE 13
    ' Process the ENTER Key
    CASE ELSE
    '********* Throw away all else ????
    END SELECT
    END SELECT
    END IF
    IF hDlg=0 THEN EXIT DO
    LOOP

    #2
    I'm not sure, maybe it has to be done in WM_KEYDOWN, but what
    about setting tMsg.WParam to zero, like:

    Code:
      SELECT CASE tMsg.WParam
        CASE 48 TO 57
          'Process the numeric keys
        CASE 13
          'Process the ENTER Key
        CASE ELSE
          tMsg.WParam = 0
      END SELECT
    ------------------

    Comment

    Working...
    X
    😀
    🥰
    🤢
    😎
    😡
    👍
    👎