I am trying to use the Squareline keyboard widget (only numbers keyboard). I would like to make the keyboard disappear when “OK” key is pressed but by default the “OK” key i grayed out and does not perform any action.
Is there any way to make that happen is Squareline software or this has to happen in the generated code by the software (LVGL code)? If through the code, Ho would you implement such action?
In general how do you access and modify the actions of each button?
The way I did it was:
The keyboard is below the screen draw area by default, and when the text field is clicked, an ‘event’ runs an animation of the keyboard’s Y position to bring it up. Then a down animation is executed in the code, in the next bit:
The way to do something when the checkmark button is pressed (is that the one you mean?) is to create an event on the keyboard which calls a custom function that is triggered by “READY”
This gets exported from SquareLine as a function into which the event is passed. I’m not sure if you need to check what key was pressed again, but I do in mine and it works exactly as expected - what you need to check for is “LV_EVENT_READY”.
and you get this (but yours would be a different keyboard, and ignore the display glitching thats something else)
@ASMD
Thanks so much for your help
That saves me a lot of time. That seems like to be the solution.
I’ll give it a try. The video is exactly what Im looking for to do.
a question,
what part of the code specifies that the checkmark button should hide the keyboard? what If I waana use the same code you suggested but this time for another key such as " * " for example (just random key).
I am trying to understand the concept of this approach to use it for other things.
Sure,
In the code snippet here, the highlighted bit runs the keyboard down animation created in SquareLine.
We get to this point in the function because we’re checking the event code that gets passed into the function. LV_EVENT_READY is the checkmark key, the star key will be a different name.
You can check for any key that is pressed. I think the key designations are in the documentation somewhere
edit:
I think maybe in SquareLine you need to change the trigger to ‘pressed’ or ‘clicked’ or something, and then you can check for they keypress you’re looking for