Announcement

Collapse
No announcement yet.

KeyDown

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

  • Scott Turchin
    replied
    Thanks Lance,

    Real quick (I hope) question...


    I intercept the keystroke down, understood on that...

    But since it has not been painted to the window yet, I'm at a loss for what I'm looking for and how to extract it...


    I know a parameter is given, ie a keystroke, but if it is the incorrect keystroke (Ie it's greater than F), how do I nullify the keystroke so the msg never gets sent back to the Dialog callback procedure?

    I'm guessing based on this that that is what happens:
    ' Pass the message on to the original window procedure... the DDT engine!
    Function = CallWindowProc(gOldSubClassProc, hWnd&, wMsg&, wParam&, lParam&)


    So lets say the user hits I instead of F, (I can see where this subclass would be GREAT for remapping a keyboard!!)...

    %WM_KEYDOWN is sent, the lowrd parameter contains the keystroke?

    Scott

    -------------
    Scott Turchin


    Leave a comment:


  • Lance Edmonds
    replied
    of course! see my posting last century at

    -------------
    lance
    powerbasic support
    mailto:[email protected][email protected]</a>

    Leave a comment:


  • Scott Turchin
    replied
    Is there an example posted on how to subclass and do this?
    Thanks

    Scott

    -------------
    Scott Turchin


    Leave a comment:


  • Lance Edmonds
    replied
    Subclass the control and intercept keystroke messages.

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

    Leave a comment:


  • Scott Turchin
    started a topic KeyDown

    KeyDown

    OK I'd like to capture each individual character sent to an edit textbox.

    The application (I tried this about 6-8 months ago), can only take the following characters:
    A-F
    0-9 'Hex characters
    So I look for those individually and everything works fine...
    But if the user puts say a K in the textbox I want to pull it out before it gets painted, how do I do that?
    Thanks!

    Code:
    Static St    As String
    Local Y      As long
    Local X      As long
    
        Case %WM_COMMAND
          Select Case LoWrd(wParam)
            Case %IDTEXT1
              Select Case CbCtlMsg
                       Case %WM_CHAR
                       Case %WM_KEYDOWN
                       Case %EN_CHANGE  'After painted to window
                       Case %EN_UPDATE  'Before painted to window
                            Control Get Text hDlg, %IDTEXT1 To NewChar
                            NewChar = Right$(NewChar,1)'Grab the new character
                            'Test to see if it fits between ascii range
                            Y = Asc(NewChar)
                            If ((Y => 48) And (Y <= 57)) Or ((Y => 65) And (Y <= 70)) Then St = St + Chr$(Y)
                            If Len(St) = 12 Then Control Enable hDlg, %IDSWAP Else Control Disable hDlg, %IDSWAP
                               
    
              End Select
    
    
            Case %IDSWAP  'Swap button
              Control Set Text hDlg, %IDTEXT2, SwapAddress(St) 'USE EN_UPPERCASE when creating
              Function = 0
              Exit Function
    Scott Turchin




    [This message has been edited by Scott Turchin (edited January 21, 2000).]
Working...
X