语言

Menu
Sites
Language
Virtual keyboard

Hello,

I am trying to implement virtual keyboard in UI native application model (not IME model) for Tizen 2.4 Mobile profile. I have tried to use ELM’s Entry widget but I run into a few problems:

  1. I am not able to set the cursor’s visibility to false
  2. The virtual keyboard are always popped up in portrait mode, even the main app’s window has been rotated to 270 degree, the text entry field itself is in landscape mode

 

Here is the relevant code snippet:

ad->win = add_win(ad->name);

elm_win_rotation_set(ad->win, 270);

 

//indicator setting

elm_win_conformant_set(ad->win,EINA_TRUE);

elm_win_indicator_mode_set(ad->win,ELM_WIN_INDICATOR_SHOW);

elm_win_indicator_opacity_set(ad->win,ELM_WIN_INDICATOR_TRANSPARENT);

 

//elm_conformant create

ad->conform = create_conform(ad->win);

ad->virtual_kb = create_virtual_kb(ad->conform);  // < ----- creating ELM’s Entry widget and add it to conform’s children

 

And here is the function create_virtual_kb():

static Evas_Object*

create_virtual_kb(Evas_Object* parent)

{

    if ( parent == NULL )

        return NULL;

    Evas_Object * vkb = elm_entry_add(parent);

    elm_object_focus_set(vkb, EINA_FALSE);

    evas_object_smart_callback_add(vkb, "changed", vkb_changed_cb, vkb);

    elm_entry_single_line_set(vkb, EINA_TRUE);

    elm_entry_input_panel_return_key_type_set(vkb,ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);

    return vkb;

}

 

Is there a sample code I can take a look that overcome the above two problems?

Thanks.

响应

12 回复
Nafisul Islam Kiron

Try,

Tizen IDE > File > New > Tizen Native Project > Template > Mobile-2.4 > Input Method Editor

and

Tizen IDE > File > New > Tizen Native Project > Online Sample > UIX > IME Sample

laura lorde

Acquire a useful new knowledge. Thanks to the site for providing very good documentation and information. slope game

jim mi

I've read through all of your postings and would like to recommend a brand-new game to you that I find to be both intriguing and appealing. I utilize it along with my pals 

James

For your first problem, you can use the elm_object_cursor_style_set() function to set the cursor style for the entry widget to "none", which will effectively hide the cursor. Here's an example of how you can modify your create_virtual_kb() function to do this:


 
c
static Evas_Object* create_virtual_kb(Evas_Object* parent) { if (parent == NULL) return NULL; Evas_Object* vkb = elm_entry_add(parent); elm_object_cursor_style_set(vkb, "none"); // hide the cursor elm_object_focus_set(vkb, EINA_FALSE); evas_object_smart_callback_add(vkb, "changed", vkb_changed_cb, vkb); elm_entry_single_line_set(vkb, EINA_TRUE); elm_entry_input_panel_return_key_type_set(vkb, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); return vkb; }

For your second problem, you can use the elm_win_keyboard_mode_set() function to set the keyboard mode for the window to "manual". This will prevent the virtual keyboard from automatically popping up when the entry widget receives focus. You can then use the elm_entry_input_panel_show() and elm_entry_input_panel_hide() functions to manually show and hide the virtual keyboard when needed.

Here's an example of how you can modify your code to implement this:


 
c
ad->win = add_win(ad->name); elm_win_rotation_set(ad->win, 270); // indicator setting elm_win_conformant_set(ad->win, EINA_TRUE); elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW); elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_TRANSPARENT); // keyboard mode elm_win_keyboard_mode_set(ad->win, ELM_WIN_KEYBOARD_MANUAL); // elm_conformant create ad->conform = create_conform(ad->win); ad->virtual_kb = create_virtual_kb(ad->conform); // manually show the keyboard when the entry widget receives focus evas_object_smart_callback_add(ad->virtual_kb, "focused", vkb_focused_cb, ad->virtual_kb); // manually hide the keyboard when the entry widget loses focus evas_object_smart_callback_add(ad->virtual_kb, "unfocused", vkb_unfocused_cb, ad->virtual_kb);

And here are the callback functions vkb_focused_cb() and vkb_unfocused_cb()https://www.normanhandymanservices.com

 
c
static void vkb_focused_cb(void* data, Evas_Object* obj, void* event_info) { elm_entry_input_panel_show(obj); } static void vkb_unfocused_cb(void* data, Evas_Object* obj, void* event_info) { elm_entry_input_panel_hide(obj); }

I hope this helps! Let me know if you have any further questions.

michealjasson

Thannk you, very informative!

Rachel Gomez

Virtual Keyboard will popup automatically when the user clicks on an input field such as textboxes and textareas.  Futhermore, the keyboard will disappear automatically when no longer needed.

This extension is ideal for touch screen devices.  This keyboard works like an iOS/Android/Windows 8 touch virtual keyboard.

 

Regards,

Rachel Gomez

Mary Solero

To hide the cursor of the Entry widget, you can use the function elm_entry_cursor_visible_set(). To make the cursor invisible, you can pass EINA_FALSE as the parameter to this function. Here's an example:


 
C
elm_entry_cursor_visible_set(vkb, EINA_FALSE);

Regarding the virtual keyboard orientation issue, you might want to try setting the orientation of the Entry widget explicitly, using the elm_entry_input_panel_orient_set() function. This function sets the orientation of the input panel, and you can set the orientation to match that of your application's window. Here's an example:


 
C
elm_entry_input_panel_orient_set(vkb, ELM_INPUT_PANEL_ORIENT_LANDSCAPE);

You can also try to set the orientation of the conformant widget and see if it helps. Here's an example:


 
C
elm_win_conformant_set(ad->win, EINA_TRUE); elm_win_rotation_set(ad->win, 270); elm_win_wm_rotation_preferred_rotation_set(ad->win, 270); elm_win_wm_rotation_available_rotations_set(ad->win, (1 << 270));

I hope these suggestions help. Let me know if you have any further questions.

Cheers,

Mary @ Austin photography services

Mary Solero

Hi! It seems like you're having a few issues with implementing a virtual keyboard in your Tizen 2.4 Mobile profile application using ELM's Entry widget. I'll do my best to help you out!

Regarding the first issue of setting the cursor's visibility to false, you can try using the elm_object_cursor_visible_set() function to accomplish this. Here's an example of how you could modify your create_virtual_kb() function to hide the cursor:


 
scss
static Evas_Object* create_virtual_kb(Evas_Object* parent) { if (parent == NULL) return NULL; Evas_Object *vkb = elm_entry_add(parent); elm_object_focus_set(vkb, EINA_FALSE); evas_object_smart_callback_add(vkb, "changed", vkb_changed_cb, vkb); elm_entry_single_line_set(vkb, EINA_TRUE); elm_entry_input_panel_return_key_type_set(vkb, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); // Hide the cursor elm_object_cursor_visible_set(vkb, EINA_FALSE); return vkb; }

As for the second issue of the virtual keyboard always popping up in portrait mode, you may need to explicitly set the orientation of the input panel using the elm_entry_input_panel_layout_set() function. Here's an example of how you could modify your create_virtual_kb() function to set the input panel orientation to landscape:


 
scss
static Evas_Object* create_virtual_kb(Evas_Object* parent) { if (parent == NULL) return NULL; Evas_Object *vkb = elm_entry_add(parent); elm_object_focus_set(vkb, EINA_FALSE); evas_object_smart_callback_add(vkb, "changed", vkb_changed_cb, vkb); elm_entry_single_line_set(vkb, EINA_TRUE); elm_entry_input_panel_return_key_type_set(vkb, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); // Set the input panel orientation to landscape elm_entry_input_panel_layout_set(vkb, ELM_INPUT_PANEL_LAYOUT_NORMAL | ELM_INPUT_PANEL_LAYOUT_NUMBER); // Hide the cursor elm_object_cursor_visible_set(vkb, EINA_FALSE); return vkb; }

Note that in the above example, I've used the ELM_INPUT_PANEL_LAYOUT_NORMAL | ELM_INPUT_PANEL_LAYOUT_NUMBER flag to set the input panel to display a combination of a standard keyboard and a number pad. You can adjust this flag to display different types of input panels as needed.

I hope this helps! Let me know if you have any further questions.

Cheers,

 

Joana Davidson

This works on https://www.elpasofencepros

Tizen IDE > File > New > Tizen Native Project > Online Sample > UIX > IME Sample

 

https://www.elpasofencepros

 

Joana Davidson
numbskull

Here's a sample code snippet that addresses your concerns:

#include <Elementary.h>

static void
vkb_changed_cb(void *data, Evas_Object *obj, void *event_info)
{
    // Your callback implementation here
}

static Evas_Object*
create_virtual_kb(Evas_Object* parent)
{
    if (parent == NULL)
        return NULL;

    Evas_Object *vkb = elm_entry_add(parent);
    elm_object_focus_set(vkb, EINA_FALSE);

    // Set cursor visibility to false
    elm_entry_cursor_line_visible_set(vkb, EINA_FALSE);

    // Set input panel layout to adjust to the parent's orientation
    elm_entry_input_panel_layout_set(vkb, ELM_INPUT_PANEL_LAYOUT_NORMAL);

    // Set the return key type
    elm_entry_input_panel_return_key_type_set(vkb, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);

    // Set entry to single line mode
    elm_entry_single_line_set(vkb, EINA_TRUE);

    // Add changed callback
    evas_object_smart_callback_add(vkb, "changed", vkb_changed_cb, vkb);

    return vkb;
}

int
main(int argc, char *argv[])
{
    // Initialize the application
    elm_init(argc, argv);

    // Create the main window
    Evas_Object *win = elm_win_add(NULL, "Virtual Keyboard Example", ELM_WIN_BASIC);
    elm_win_autodel_set(win, EINA_TRUE);

    // Set window rotation
    elm_win_rotation_set(win, 270);

    // Create a conformant
    Evas_Object *conform = elm_conformant_add(win);
    elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW);
    elm_win_indicator_opacity_set(win, ELM_WIN_INDICATOR_TRANSPARENT);
    elm_win_resize_object_add(win, conform);
    evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show(conform);

    // Create virtual keyboard entry
    Evas_Object *virtual_kb = create_virtual_kb(conform);
    evas_object_size_hint_weight_set(virtual_kb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_object_content_set(conform, virtual_kb);
    evas_object_show(virtual_kb);

    // Show and run the application
    evas_object_show(win);
    elm_run();

    // Clean up
    elm_shutdown();
    return 0;
}

This sample code includes:

  1. Setting the cursor's visibility to false using elm_entry_cursor_line_visible_set.
  2. Adjusting the input panel layout based on the parent's orientation using elm_entry_input_panel_layout_set.

You can use this code as a reference to overcome the mentioned problems in your application. Make sure to integrate it properly into your existing codebase and adjust it as needed.