Results 1 to 3 of 3

Thread: ActiveX - Tab Not Detected [*** RESOLVED ***]

  1. #1

    Thread Starter
    Addicted Member finn0013's Avatar
    Join Date
    Jan 2001
    Location
    Charleston, SC
    Posts
    222

    Exclamation ActiveX - Tab Not Detected [*** RESOLVED ***]

    I have an active X control with multiple picture boxes in it. I currently have it set up so that I can detect the keydown event for anything but the tab key. I don't care about the control losing focus as long as I can detect that the tab key was pressed, however I have not been able to do this...


    Help!!!
    Last edited by finn0013; Dec 15th, 2004 at 09:24 PM. Reason: resolved

  2. #2

    Thread Starter
    Addicted Member finn0013's Avatar
    Join Date
    Jan 2001
    Location
    Charleston, SC
    Posts
    222

    Re: ActiveX - Tab Not Detected

    I have tried everything I can think of including subclassing the control (as well as each of the subcontrols) to listen for the tab key with no success.

    The only way I have found to do it is with the following code snippets:
    http://www.vbaccelerator.com/home/VB/Code/Techniques/Trapping_The_Tab_Key_in_a_UserControl_with_IOLEInPlaceActiveObject/article.asp

  3. #3

    Thread Starter
    Addicted Member finn0013's Avatar
    Join Date
    Jan 2001
    Location
    Charleston, SC
    Posts
    222

    Re: ActiveX - Tab Not Detected

    If you end up using the code in the above link make sure you replace the ShiftState property with this one to ensure that you do not get overflow erros.
    Code:
     
    Private Property Get ShiftState() As Integer
    
        Dim s, c As Long
    
        s = GetAsyncKeyState(vbKeyShift)
        c = GetAsyncKeyState(vbKeyControl)
        
        If s And vbShiftMask > 0 And c And vbCtrlMask > 0 Then
            ShiftState = 3
        ElseIf s And vbShiftMask > 0 Then
            ShiftState = 1
        ElseIf c And vbCtrlMask > 0 Then
            ShiftState = 2
        Else
            ShiftState = 0
        End If
    
    End Property

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width