first commit
This commit is contained in:
commit
e6a42e28e9
4355 changed files with 4626605 additions and 0 deletions
|
|
@ -0,0 +1,40 @@
|
|||
#include "../../lv_examples.h"
|
||||
#if LV_USE_KEYBOARD && LV_BUILD_EXAMPLES
|
||||
|
||||
static void ta_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t * ta = lv_event_get_target(e);
|
||||
lv_obj_t * kb = lv_event_get_user_data(e);
|
||||
if(code == LV_EVENT_FOCUSED) {
|
||||
lv_keyboard_set_textarea(kb, ta);
|
||||
lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
|
||||
if(code == LV_EVENT_DEFOCUSED) {
|
||||
lv_keyboard_set_textarea(kb, NULL);
|
||||
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
void lv_example_keyboard_1(void)
|
||||
{
|
||||
/*Create a keyboard to use it with an of the text areas*/
|
||||
lv_obj_t * kb = lv_keyboard_create(lv_scr_act());
|
||||
|
||||
/*Create a text area. The keyboard will write here*/
|
||||
lv_obj_t * ta;
|
||||
ta = lv_textarea_create(lv_scr_act());
|
||||
lv_obj_align(ta, LV_ALIGN_TOP_LEFT, 10, 10);
|
||||
lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_ALL, kb);
|
||||
lv_textarea_set_placeholder_text(ta, "Hello");
|
||||
lv_obj_set_size(ta, 140, 80);
|
||||
|
||||
ta = lv_textarea_create(lv_scr_act());
|
||||
lv_obj_align(ta, LV_ALIGN_TOP_RIGHT, -10, 10);
|
||||
lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_ALL, kb);
|
||||
lv_obj_set_size(ta, 140, 80);
|
||||
|
||||
lv_keyboard_set_textarea(kb, ta);
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue