lc-soft / LCUI

C library for building user interfaces
https://lcui-dev.github.io
MIT License
4.12k stars 356 forks source link

Keyboard Input Doesn't Work (Windows x64) #284

Closed CycloneRing closed 2 years ago

CycloneRing commented 2 years ago

Describe the bug Hello @lc-soft, I really liked your gui library, I have an issue and I'm not sure if this is a bug, Anyhow I couldn't fix it myself in more than 1 week, I hope you can help me to solve it. I tried to merge lcui and lcui design to a static build on windows, It works perfectly so far the only problem is keyboard input doesn't work on text inputs, I checked keyboard functions and all of them receiving input but still it doesn't work, none of the source codes are manipulated and they are original.

To Reproduce Steps to reproduce the behavior:

  1. Download LCUI and Dependencies
  2. Configuring Projects to Static and MT
  3. Build & Run

Environment :

Update 1 :

Here is the full source code : LCUI-Static-Win64.zip

lc-soft commented 2 years ago

The processing flow of textinput event is as follows:

WIN_ProcessEvents() -> WndProc() -> WM_CHAR -> WinIME_OnChar() -> LCUIIME_Commit() -> LCUI_TEXTINPUT -> OnTextInput() -> LCUI_WEVENT_TEXTINPUT -> TextEdit_OnTextInput()

I'll take the time to test it.

CycloneRing commented 2 years ago

I'll take the time to test it.

@lc-soft Thanks! ~I just noticed issue is from lcui 2.2.0.~

  1. I downloaded lcui source from https://github.com/lc-soft/LCUI/archive/refs/tags/v2.2.0.zip
  2. I built it without any changes
  3. I replaced the dll in lc-design-demo and still inputs not working.

Still the provided build at https://github.com/lc-soft/LCUI/archive/refs/tags/ works fine, I'm not sure what's wrong maybe it's from my vs compiler or windows sdk, No idea :(

lc-soft commented 2 years ago

The cause of problem is that you have modified the Windows SDK version in the project configuration. The LCUI project configuration is using Visual Studio 2017 - Windows XP (v141_xp) toolset.

image

LCUI has no input method support for UWP (Universal Windows Platform), so the Win32 input method is not registered when the WINAPI_FAMILY_APP macro is defined, but this is not correct, it should be changed to:

image

CycloneRing commented 2 years ago

Oh thank you, I'm not using UWP, just regular C++ not for xp, It fixed the issue, Cheers 🥂 I'm closing the issue but since it's related to keyboard, Can we add tab support to lcui? I noticed Tab doesn't switch keys and inputs.

lc-soft commented 2 years ago

Yes, you can add it, but I recommend that you create a new issue describing all the details of this feature before you plan to do it.

CycloneRing commented 2 years ago

Thanks, I try it myself if I couldn't I make a new issue. 祝您度过愉快的一天!