Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    KeyDown Event Conflict? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    I have a continuous Sub Form with a combo box as the first field and I trying to implement the following Up/Down Arrow key behavior

    1. I want the operator to be able to Up/Down Arrow Key within the scope of records.
    2. I want the operator to be able to press F4 Key (open combo) and with the Arrow Keys select the proper entry

    When I

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: KeyDown Event Conflict? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    John,

    Copy Dev Ashish's code under 1) Detecting combo state via class name from API: Determining Combobox's Dropped state to a standard module.

    Immediately under Case vbKeyUp, and also immediately below Case vbKeyDown in your KeyDown event, insert the following line:

    If fIsComboOpen = True Then Exit Sub

    This prevents the RunCommand instruction from being executed if the dropdown list is open.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: KeyDown Event Conflict? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    I think that will be hard - if "Fox" is the only item starting with "Fo", "Fox" will be selected (from the list) as soon as the user types "Fo". Does this count as typing "Fox" or not? The user didn't actually type the word, but didn't open the dropdown list either. And perhaps more important, what does it matter? If the user types something that is not in the list, the On Not In List event will catch that if Limit To List is Yes, but otherwise, why would you want to know whether the user typed or selected the value?

    You could declare a variable fWasOpened of type Boolean at the top of the form module, set it to False in the On Enter event of the combo box, and use the timer event of the form to check periodically if the dropdown list has been opened:

    Private Sub Form_Timer()
    If fIsComboOpen = True And Me.ActiveControl.Name = "T" Then
    fWasOpened = True
    End If
    End Sub

    Set the Timer Interval of the form to (for example) 1000 (milliseconds)

    By the way, you seem to have a problem posting links to other posts. This is the second time you posted a link to # 1917, which is in Words From On High.

  4. #4
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: KeyDown Event Conflict? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    Hi Hans

    Another great discovery for me.

    This raises another question I tried to get answered in :

    <post#=326112>post 326112</post#> Selected From Combo Box Dropdown or Typed In? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    What I need to know in combo After Updare Event is, did I select the vale from a OPEN combo box or did I just type in the value from a CLOSED combo box?.

    Say the word

Posting Permissions

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