语言

Menu
Sites
Language
Entry Anchor in Tizen Native

Hello, 

Can someone show me a good example of using Anchors in Entry Widget?

For example, Entry element with 2 or more different callbacks using anchor

响应

5 回复
Jean Yang

Hi, 

From my understanding Anchors callback is same to other callback in entry, but  the difference is need to set the Anchor part

1, set the text part like this    ---- <a href = ..>...</a>: Anchors

2. register the callback        evas_object_smart_callback_add(input_field_entry, "anchor,clicked", anchor_clicked_cb, NULL);

3. implement the callback       anchor_clicked_cb(void *data, Evas_Object *obj, void *event_info)

when you click the anchor part, the call back will be called.

Jean Yang

Hi, 

From my understanding Anchors callback is same to other callback in entry, but  the difference is need to set the Anchor part

1, set the text part like this    ---- <a href = ..>...</a>: Anchors

2. register the callback        evas_object_smart_callback_add(input_field_entry, "anchor,clicked", anchor_clicked_cb, NULL);

3. implement the callback       anchor_clicked_cb(void *data, Evas_Object *obj, void *event_info)

when you click the anchor part, the call back will be called.

Ashwini Kumar

Hi,

Even was trying to use Anchor text.

The issue is I didn't get the callback function on 'anchor,clicked'.

Instead the copy/select etc... options appear with a magnifier.

Thanx,

Ashwini

Vikram

fyi.

The "event->name" is the value of href of an anchor, you can use the name to identify the anchor in an entry with multi anchors.

    
static void
anchor_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
    Elm_Entry_Anchor_Info *event = (Elm_Entry_Anchor_Info*)event_info;
	dlog_print(DLOG_INFO, LOG_TAG, "Elm_Entry_Anchor_Info, Name: %s\n", event->name);
}


    Evas_Object* entry;

	/* Naviframe */
	ad->naviframe = elm_naviframe_add(ad->conform);
	evas_object_show(ad->naviframe);

	entry = elm_entry_add(ad->naviframe);
	elm_entry_scrollable_set(entry, EINA_TRUE);
	elm_object_part_text_set(entry, "elm.text", "<a href=anc-01>this one is an anchor</a> this one is a normal text");
	eext_entry_selection_back_event_allow_set(entry, EINA_TRUE);
	evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
	evas_object_smart_callback_add(entry, "anchor,clicked", anchor_clicked_cb, NULL);

	elm_naviframe_item_push(ad->naviframe, "entry", NULL, NULL, entry, NULL);
	return ad->naviframe;

 

Garik Bezruchko

thank you!