Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. [VC++ & XAML] a Keydown event bug with the touch keyboard on a metro app: please help me...

[VC++ & XAML] a Keydown event bug with the touch keyboard on a metro app: please help me...

Scheduled Pinned Locked Moved Windows API
helptutorialquestionc++wpf
2 Posts 2 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 9979743
    wrote on last edited by
    #1

    Hi, I am a beginner for Metro app development and trying to use the keydown event but not the keyup event with a text box element on the XAML. I have created two key event functions (up and down) from the text box, which are the below. The problem is the keydown function works only when the key is up but not down. If I hold the key press down, the event does not come out until the key up, which is the same as the keyup function. I am working to get keyboard input from the touch softkeyboard. For example, after invoking the touch keyboard with the text box element, I like to play a unique sound only when a key (e.g., 'Q' or 'K') is pressed. Anyone knows how to fix this problem? I also appreciate that you can help me know the alternative way with an example source code. Thank you a lot in advance. MainPage::OnKeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) { if((int)e->Key == 112) // F1 key { errorText->Text = "F1 Key up"; } } MainPage::OnKeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) { if((int)e->Key == 112) // F1 key { errorText->Text = "F1 Key down"; } } I just found that only space key, backspace and enter key are working for keydown but all other keys are sending the key down event when the key is released on the touch keyboard. So my question must be rephrased to how to make all other keys send the keydown event on the Keydown api? or the other apis? Thank you.

    L 1 Reply Last reply
    0
    • M Member 9979743

      Hi, I am a beginner for Metro app development and trying to use the keydown event but not the keyup event with a text box element on the XAML. I have created two key event functions (up and down) from the text box, which are the below. The problem is the keydown function works only when the key is up but not down. If I hold the key press down, the event does not come out until the key up, which is the same as the keyup function. I am working to get keyboard input from the touch softkeyboard. For example, after invoking the touch keyboard with the text box element, I like to play a unique sound only when a key (e.g., 'Q' or 'K') is pressed. Anyone knows how to fix this problem? I also appreciate that you can help me know the alternative way with an example source code. Thank you a lot in advance. MainPage::OnKeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) { if((int)e->Key == 112) // F1 key { errorText->Text = "F1 Key up"; } } MainPage::OnKeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) { if((int)e->Key == 112) // F1 key { errorText->Text = "F1 Key down"; } } I just found that only space key, backspace and enter key are working for keydown but all other keys are sending the key down event when the key is released on the touch keyboard. So my question must be rephrased to how to make all other keys send the keydown event on the Keydown api? or the other apis? Thank you.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Please stop spamming the forums, or you are likely to get your account closed.

      Use the best guess

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups