我一直在从事一个tizen项目,我需要计算一个人的BMI。因此,我需要输入用户名的名称以及用户的身高和体重。到目前为止,我已经创建了一个功能界面,可以在其中将用户导航到选项。我可以提示输入和键盘弹出。但是我不确定如何像我们在Android上一样在变量中获取输入:int/String x = editText.getText()
我已经搜索了很多东西,但是Tizen社区在文档上似乎更加先进。任何帮助将不胜感激。以下是编辑文本的一些代码(用于文本输入)。我只需要知道如何从中提取输入值。
编辑文本代码:
static Evas_Object *
create_singlelines_editfield_layout(Evas_Object *parent) {
Evas_Object *editfield, *entry, *button, *buttonOk;
editfield = elm_layout_add(parent);
elm_layout_theme_set(editfield, "layout", "editfield", "singleline");
evas_object_size_hint_align_set(editfield, EVAS_HINT_FILL, 0.5);
evas_object_size_hint_weight_set(editfield, EVAS_HINT_EXPAND, 0.5);
entry = elm_entry_add(editfield);
elm_entry_single_line_set(entry, EINA_TRUE);
elm_entry_scrollable_set(entry, EINA_TRUE);
elm_object_part_text_set(entry, "elm.guide", "Enter Your Weight");
evas_object_smart_callback_add(entry, "focused", editfield_focused_cb, editfield);
evas_object_smart_callback_add(entry, "unfocused", editfield_unfocused_cb, editfield);
evas_object_smart_callback_add(entry, "changed", editfield_changed_cb, editfield);
evas_object_smart_callback_add(entry, "preedit,changed", editfield_changed_cb, editfield);
elm_object_part_content_set(editfield, "elm.swallow.content", entry);
//elm_object_part_content_set(editfield, "elm.swallow.button", button);
return editfield;
}
谢谢
char const * const text = elm_entry_entry_get(ad->input);
您可以通过以下方式看到它:
https://github.com/rzr/ekzekuto