Results 1 to 6 of 6

Thread: sstab bug?

  1. #1

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    I don't understand why this is needed but it fixes the problem.

    VB Code:
    1. Select Case KeyCode
    2.         Case vbKeyF9
    3.             tabTest.Tab = 0
    4.             DoEvents
    5.         Case vbKeyF10
    6.             tabTest.Tab = 1
    7.             DoEvents
    8.         Case vbKeyF11
    9.             tabTest.Tab = 2
    10.             DoEvents
    11.     End Select
    12.     [b]KeyCode = 0[/b]

  2. #2

  3. #3
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    sstab bug? [Resolved]

    When using the sstab, I setup function keys to move between the tabs on the keydown event. This works for the most part, but sometimes not.

    Example:

    I have 3 tabs (F9,F10,F11). If I hit F10, it acts like it hangs... not responding to further presses of F11 or F9. However, if I go to F11, I can easily bounce between F9 and F11 and the tabs respond accordingly.

    Also, I have another sstab with 5 and I've setup F1 and F2 to cycle through the tabs... for some reason it doesn't want to jump correctly.

    Here is the code:
    VB Code:
    1. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    2.  
    3.    On Error GoTo Form_KeyDown_Error
    4.  
    5.     If KeyCode = vbKeyF3 Then
    6.         If tabOptions.Visible = False Then
    7.             cmdStop_Click
    8.         End If
    9.     End If
    10.     If KeyCode = vbKeyF4 Then
    11.         If tabOptions.Visible = True Then
    12.             cmdStart_Click
    13.         End If
    14.     End If
    15.  
    16. If tabOptions.Visible = True Then
    17.     Select Case KeyCode
    18.         Case 13
    19.             If tabOptions.Tab = 2 Then
    20.                 cmdAdd_Click
    21.             End If
    22.             If tabOptions.Tab = 5 Then
    23.                 cmdAddLimit_Click
    24.             End If
    25.         Case vbKeyF1
    26.             If tabOptions.Tab <> 0 Then
    27.                 tabOptions.Tab = tabOptions.Tab - 1
    28.             End If
    29.         Case vbKeyF2
    30.             If tabOptions.Tab <> 3 Then
    31.                 tabOptions.Tab = tabOptions.Tab + 1
    32.             End If
    33.         Case vbKeyF8
    34.             tabOptions.Tab = 4
    35.             DoEvents
    36.         Case vbKeyF9
    37.             tabOptions.Tab = 0
    38.             DoEvents
    39.         Case vbKeyF10
    40.             tabOptions.Tab = 1
    41.             DoEvents
    42.         Case vbKeyF11
    43.             tabOptions.Tab = 2
    44.             DoEvents
    45.         Case vbKeyF12
    46.             tabOptions.Tab = 3
    47.             DoEvents
    48.     End Select
    49. Else
    50.     Select Case KeyCode
    51.         Case vbKeyF9
    52.             tabTest.Tab = 0
    53.             DoEvents
    54.         Case vbKeyF10
    55.             tabTest.Tab = 1
    56.             DoEvents
    57.         Case vbKeyF11
    58.             tabTest.Tab = 2
    59.             DoEvents
    60.     End Select
    61. End If

    Anyone know if I'm doing something wrong or whether this is just a bug??
    Last edited by ober0330; Jun 10th, 2004 at 07:06 AM.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  4. #4
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654
    The problem might not be in your switching code, but in the code handled after the change. I didn't see a problem in the code above.

  5. #5
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    If I hit F10, it acts like it hangs
    F10 is used by Windows to move focus to a menu. If the current window does not have a menu, then focus is moved to the Windows Control menu. Note - the Form_KeyDown event does not fire if a menu has focus.

    Try it, hit F10 and then hit the down arrow - a menu should popup. Hitting F10 twice should move focus back to the form.

    As Martin pointed out, setting the keycode to 0 will stop Windows from processing the F10 key.

  6. #6
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Thank you very much Martin, and Bruce for the explaination.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

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