Need help with my diploma thesis.

I made a program for my ESP32 7inch HMI Display using SquareLineStudio. The program works fine. I have some inputs of values I need in my c program. I get them using a textarea with a keyboard. But I dont know how to get the values in my c program. Could anyone help me with this?

Comments

  • Hello @mathi_kbr ,
    https://docs.lvgl.io/master/details/widgets/keyboard.html
    You can connect a keyboard to an lv_textarea (text area) component and then retrieve the text content from this lv_textarea.
    `
    // Create a text area (textarea)
    lv_obj_t *textarea = lv_textarea_create(lv_scr_act());
    lv_textarea_set_one_line(textarea, true); // Set to single-line input (if needed)
    lv_obj_set_width(textarea, 200); // Set the width of the text area

    // Create a keyboard
    lv_obj_t *keyboard = lv_keyboard_create(lv_scr_act());
    lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_TEXT_LOWER); // Set to lowercase mode (optional)
    lv_keyboard_set_textarea(keyboard, textarea); // Connect the keyboard and text area

    // Retrieve the input content
    const char *input_text = lv_textarea_get_text(textarea);
    printf("Input Text: %s\n", input_text); // Print or process the input content
    `
    Explanation:
    Create a Text Area: Use lv_textarea_create() to create a text area for keyboard input.
    Create a Keyboard and Set Mode: Use lv_keyboard_create() to create a keyboard, which can be set to lowercase mode, etc.
    Connect the Keyboard and Text Area: Use lv_keyboard_set_textarea() to associate the keyboard with the textarea. This way, the keyboard input will display in the textarea.
    Retrieve Input Content: When you need to get the input content, call lv_textarea_get_text(textarea) to obtain the current input text.
    In this way, you can easily retrieve the user's keyboard input for assignment or further processing.

Sign In or Register to comment.