Is there any way to hook into React Three Drei KeyboardControls and programatically trigger a key press? - three.js

Is there any way to hook into react three drei KeyboardControls and programatically trigger a key press?
Here are the docs for the KeyboardControls component, it seems to use zustand under the hood:
https://github.com/pmndrs/drei#keyboardcontrols
I've tried all sorts, including:
Is it possible to simulate key press events programmatically?
As well as using useRef but I can't seem to find a way to create buttons for scenarios where the user does not have a keyboard (such as on mobile).
Does anyone know if this is possible?

Related

Xamarin - support inserting GIF and images using Android keyboard

Has anyone gotten the android keyboard to support GIF and image insertion in an Xamarin app? Let's say I want to build a chat application, have a custom EditText view to capture user input, and want to have it behave similar to the Android built-in chat application. Currently the keyboard shows a popup . Is it possible to make this work? I prefer to not create a custom keyboard renderer, though was hoping this could be done within a custom EditText renderer. Along the lines of:
UPDATE: For anyone looking for a similar solution, I have been making progress using the https://github.com/xamarin/monodroid-samples/tree/main/android-n/CommitContentSample. Essentially set the content mime types and wrap the IOnCommitContentListener, then process OnCommitContent().

How can I detect 2 button pressed at the same time?

I have a winphone app with several buttons on a page. I want to be able to press them two (or more) at a time. Unfortunately when I press two buttons (with 2 fingers), only one of them gets the click or tap events and the other one does not. How can I know that 2 buttons are pressed?
According to the post below, you could achieve this by using Touch.FrameReported event.
Pressing multiple buttons simultaneously
What underlying framework are you using ? Is it C++ or C# ? XNA or WPF/XAML ? WP7 or WP8?
As Kulasangar pointed Touch.FrameReported should be the way to do it in C#.
For XNA you will have to enable the MultiTouch and then use the TouchCollection class. That will give you access to multiple touches.
In DirectX you might have to use managed C++ and listen to one of the system events.
Things might change based on the platform ( WP7 or WP8 )

Press key programmatically w/ Cocoa

I was thinking if it's possible to press a key (as a) with Cocoa. I already searched in the web, but I don't found anything. Actually, I don't want to use AppleScript or Python to do it. Just cocoa.
Any idea?
Thanks in advance!
I'm not entirely sure what you want, but you can work with system wide events through EventTaps.
Quartz Event services reference
I'm not entirely sure what the appstore allows, I do know my app with a listening event tap has been approved. There are 2 types of taps, filtering and listening => their names are both pretty straight forward. I think using a event tap you should also be able to post new events.. ( thus fake a key press.. )

Gestures using MVVM light toolkit

I am using the MVVM light toolkit in a WP7 application and I am trying to wire up a canvas element's appropriate event to my view model using the 'EventToCommand' behavior. The event I am looking to intercept is the 'swipe up' gesture.
I have currently tried relaying the 'KeyUp' event but that doesn't behave like I had assumed it would. Is this even possible using behaviors or should I be doing something else? All the events I wire up to the viewmodel using the EventToCommand behavior work fine, but my basic problem is that I can't find an event for a swipe. I'm guessing gestures are handled differently?
What you need is a way to enable a gesture to trigger the behaviour.
Fortunately, Kevin Marshal wrote just such a thing and blogged about it.

Disable webview keyboard equivalents

I've got a webview in my window (well, several) and want to use the delete key for a custom action. Is there a way to disable the delete key shortcut in the webview so i can use it for something else?
I managed to do it via the webkit javascript bridge. Just check for the key in a javascript event and then call an obj-c method from there.
The WebEditingDelegate will let you know if a command is about to performed, and so you could override that perhaps.

Resources