Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ulViewFireKeyEvent Documentation/help #503

Open
jeff8j opened this issue Apr 11, 2024 · 3 comments
Open

ulViewFireKeyEvent Documentation/help #503

jeff8j opened this issue Apr 11, 2024 · 3 comments

Comments

@jeff8j
Copy link

jeff8j commented Apr 11, 2024

I cant seem to get a keypress working with the CAPI

I am trying to trigger a "e" keycode 69 in js keypress and release

when creating the key event with ulCreateKeyEvent
do i put 69 as the virtual_key_code or the native_key_code?
what do I put for the ULString text and unmodified_text should I create a blank ULString?

@adamjs
Copy link
Member

adamjs commented Apr 11, 2024

Are you synthesizing the key presses yourself or translating them from an existing framework?

I would actually look at Sample 7, specifically where it takes GLFW keypress (WindowGLFW_key_callback) and GLFW char events (WindowGLFW_char_callback) and translates them into appropriate Ultralight events for guidance on using this API: https://github.com/ultralight-ux/Ultralight/blob/master/samples/Sample%207%20-%20OpenGL%20Integration/src/Window.cpp

@jeff8j
Copy link
Author

jeff8j commented Apr 11, 2024

At the moment I am trying to synthesize the input to get it working, the end result will come from sdl
This is my keydown code I trigger it with the sdl keydown then trigger the up when releases
I have tried various keycode/scancode/text combos and cant get anything to work at all
I load a js key tester page to make sure its not my js https://keyjs.dev/ and it gets nothing as well

int keycode = 69; // 101;
int scancode = 8;
ULString keytext = ulCreateString("E");

ULKeyEvent evt = ulCreateKeyEvent(kKeyEventType_RawKeyDown, 0, keycode, scancode, keytext, keytext, false, false, false);
ulViewFireKeyEvent(view, evt);
ulDestroyKeyEvent(evt);

@jeff8j
Copy link
Author

jeff8j commented Apr 12, 2024

I pulled out the relevant code from my program and made a small program that has the same problem
https://github.com/jeff8j/Ultralight-SDL-Key-Test/blob/main/main.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants