|
这个代码片段展示了如何创建过滤器入口基本小部件。 演示了两个过滤器:限制条目的大小和限制接受的字符集。
- static Elm_Entry_Filter_Accept_Set accept_set = { .accepted = "0123456789", .rejected = NULL };
- static Elm_Entry_Filter_Limit_Size limit_size = { .max_char_count = 9 };
- static void number_entry_test(appdata_s *ad) {
- //create a box to pack the entry frame
- Evas_Object *box = elm_box_add(ad->win);
- evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0);
- elm_win_resize_object_add(ad->win, box);
- evas_object_show(box);
- //create a frame to pack the entry
- Evas_Object *frame = elm_frame_add(ad->win);
- elm_object_text_set(frame, "Phone number entry");
- elm_box_pack_end(box, frame);
- evas_object_show(frame);
- //create the entry
- Evas_Object* entry = elm_entry_add(ad->win);
- elm_entry_single_line_set(entry, EINA_TRUE);
- //add filters
- elm_entry_markup_filter_append(entry, elm_entry_filter_accept_set, &accept_set);
- elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_size);
- elm_object_content_set(frame, entry);
- evas_object_show(entry);
- }
复制代码 |
|