Detecting pressed down keys in Xamarin macOS

VRahikkaVRahikka Member ✭✭

Hi,

Is there any way to check are there any buttons pressed down? Not necessarily interested in the events.

Thanks!

Best Answer

  • VRahikkaVRahikka ✭✭
    Accepted Answer

    Sorry for fuzzy reply.

    Checking NSEvent.CurrentModifierFlags did the trick for me.

    Thanks!

Answers

  • VRahikkaVRahikka Member ✭✭

    Thanks for the link. I already tried NSEvent.AddLocalMonitorForEventsMatchingMask(NSEventMask.KeyDown, KeyboardEventHandler);, but it did not work. My software has only status bar icon, no UI, and my guess is that this NSEvent.AddLocalMonitorForEventsMatchingMask requires focus to the UI.

  • ChrisHamonsChrisHamons USXamarin Team Xamurai

    Unfortunately "it does not work" doesn't give a lot of detail for people here to work with.

    Without a small sample, or significantly more detail, I doubt anyone is going to be able to answer your question.

  • VRahikkaVRahikka Member ✭✭
    Accepted Answer

    Sorry for fuzzy reply.

    Checking NSEvent.CurrentModifierFlags did the trick for me.

    Thanks!

Sign In or Register to comment.