hi,
I'm following the LearnLVGL Version 9 course from Mair Swartz
setup :
vscode running on Windows 11
WSL2 for the dev on platformio (opensuse tumbleweed) sdl2 and sdl2-compat installed
I have made plenty of small project with some widget following the course with no issue, so the setup seems ok (no compile issue)
exept when I use a text area object, the keyboard input are not taken
- no text appear in the widget
- nothing retreivable by
lv_textarea_get_text
here the code
#include "lvgl.h"
#include "app_hal.h"
void basic_keyboard(void);
void on_text_changed(lv_event_t* event);
void on_text_changed(lv_event_t* event)
{
if (lv_event_get_code(event)==LV_EVENT_VALUE_CHANGED)
{
lv_obj_t* text_input = lv_event_get_target_obj(event);
lv_log("Text is: %s\n", lv_textarea_get_text(text_input));
}
}
void basic_keyboard(void)
{
lv_obj_t* text_input = lv_textarea_create(lv_screen_active());
lv_obj_add_event_cb(text_input, on_text_changed, LV_EVENT_ALL, NULL);
}
int main(void)
{
lv_init();
hal_setup();
basic_keyboard();
hal_loop();
}
and the platformio.ini
[platformio]
default_envs = emulator_64bits
; Shared options
[env]
build_flags =
; Don't use lv_conf.h. Tweak params via platform.ini.
-D LV_CONF_SKIP
-D LV_CONF_INCLUDE_SIMPLE
; Enable LVGL demo, remove when working on your own project
; -D LV_USE_DEMO_WIDGETS=1
; Add more defines below to override lvgl:/src/lv_conf_simple.h
lib_deps =
; Use direct URL, because package registry is unstable
lvgl@9.3
lib_archive = false
[env:emulator_64bits]
platform = native@^1.1.3
extra_scripts =
pre:support/sdl2_paths.py ; Tries to find SDL2 include and lib paths on your system - specifically for MacOS w/ Homebrew
post:support/sdl2_build_extra.py
build_flags =
${env.build_flags}
-D LV_USE_LOG=1
-D LV_LOG_LEVEL=LV_LOG_LEVEL_WARN
-D LV_LOG_PRINTF=1
-D LV_USE_SYSMON=1
-D LV_USE_PERF_MONITOR=1
-D LV_USE_STDLIB_MALLOC=LV_STDLIB_BUILTIN
-D LV_USE_MEM_MONITOR=1
; Add recursive dirs for hal headers search
!python -c "import os; print(' '.join(['-I {}'.format(i[0].replace('\x5C','/')) for i in os.walk('hal/sdl2')]))"
-lSDL2
; SDL drivers options
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_DRV_NO_CONF
-D LV_USE_SDL
-D SDL_HOR_RES=480
-D SDL_VER_RES=320
-D SDL_ZOOM=1
-D LV_SDL_INCLUDE_PATH="\"SDL2/SDL.h\""
; LVGL memory options, setup for the demo to run properly
-D LV_MEM_CUSTOM=1
-D LV_MEM_SIZE="(128U * 1024U)"
lib_deps =
${env.lib_deps}
build_src_filter =
+<*>
+<../hal/sdl2>
Am I missing someting
tried to add -D LV_USE_KEYBOARD=1 with no effet :/
hi,
I'm following the LearnLVGL Version 9 course from Mair Swartz
setup :
vscode running on Windows 11
WSL2 for the dev on platformio (opensuse tumbleweed) sdl2 and sdl2-compat installed
I have made plenty of small project with some widget following the course with no issue, so the setup seems ok (no compile issue)
exept when I use a text area object, the keyboard input are not taken
lv_textarea_get_texthere the code
and the platformio.ini
Am I missing someting
tried to add -D LV_USE_KEYBOARD=1 with no effet :/