What do you want to achieve?
I am working on a project which requires user inputs to supply information like WiFi SSID, Password etc. I would envision that one could bind a keyboard to a text field and have it pop up with a visible edit field. In a small display the keyboard overlaps the text field and I can’t see what is entered.
Additionally the keyboard has some items which aren’t always needed like the little keyboard icon, CRLF. I suppose I could remove those in source but it’d be nice of they could be options selected in the Squareline GUI.
What have you tried so far?
I created a separate screen with a keyboard and text field on it and slid it over top the WiFi screen. However this is rather awkward as it loses track of the screen and edit control it came from (no “screen stack” that I know of)
Screenshot or video
I tried to upload the project but not permitted.
Here is what the project looks like:
Others
- SquareLine Studio version: 1.5.0
- Operating system: Windows
- Target hardware: ESP32 320x240 display
So I have made a compromise fix for this. On CLICK of the SSID and Password textfields I have added events to populate the keyboard screen textinput with the exsisting values. When the keyboard input screen is closed it copies the text value from the keyboard screen testinput back to the associated control.
I was hoping for a cleaner solution but I guess this works well enough.
In ui_events.cpp:
static lv_obj_t *ui_TextAreaSave;
void setTextInput(lv_event_t *e)
{
ui_TextAreaSave = (lv_obj_t *)lv_event_get_target(e); // have to cast it to satisfy compiler
lv_textarea_set_text(ui_TextAreaTextValue, lv_textarea_get_text(ui_TextAreaSave));
}
void setTextFromSave(lv_event_t *e)
{
lv_textarea_set_text(ui_TextAreaSave, lv_textarea_get_text(ui_TextAreaTextValue));
}
1 Like
Hi, if you want to use a keyboard on such a small display, there shouldn’t be anything else on the screen besides the keyboard and text field to make keyboard usage as comfortable as possible. So, the concept of putting it on a separate screen is good. I might change one thing: on the ScreenSettings screen, instead of textareas, I would just use labels with a “Set” button next to them that brings up the other screen. But honestly, your implementation is fine too. You asked how to add custom keys to the SLS. Unfortunately, it’s not possible directly, but if you create a custom LVGL keyboard, you can swap it out programmatically.