语言

Menu
Sites
Language
Current cursor position inside entry

Hi all

I have some entry widget which contains anchor (some markup), something like this:

elm_entry_entry_append(entry, "Hello EFL <a href=http://ya.ru><link>My link</link></a> End");
evas_object_smart_callback_add(entry, "cursor,changed", entry_cursor_changed_cb, NULL);

Source of my entry with full markup is: 
1) "Hello EFL <a href=http://ya.ru><link>My link</link></a> End"
How it is displayed on screen
2) "Hello EFL My link End"

I use elm_entry_cursor_pos_get(obj)) to get cursor position inside of my entry. But I always got position for case 2 (excluding markup).

For example: if cursor current position is after word 'My' - current position is 12
But real cursor position (with markup) should be 39

Is there some api in Tizen or some way to get such real cursor position?

Alexey.

响应

7 回复
BeomChan Park

I think every widget in EFL Library doesn't support <a> tag.

I tried that with Z1 and TM1, they didn't work.

IF you think a little bit more, You will get reached This tag will not work couse of EFL's not supporting something like webview.

for my answer to answer1

you want't to react to touch event, you should make app_control to call com.samsung.browser and destroy it at  your defiened callback.

Alex Dem

Hi. 
Tag a (anchor) is supported for entry and I able to add "anchor,clicked" callback .  In any case thank you for response but here is another problem. It is should be some text editor (strictly inside entry widget) which allow edit text inside entry. 
Alexey.

Alex Dem

Up, looks like no suggestions.
Alexey.

Alex Dem

Up.

colin Rao

Hi,

One stupid workaround. Call elm_entry_cursor_content_get() to get the content of current position. Then, call elm_entry_entry_get() to get the whole text. After that, search the position of current cursor content from the whole entry text.

As I remmber, elm_entry_entry_get() will return the fulltext of the entry including the markup tag. Possible, you can take a try.

Jean Yang

In fact, the invisible tags will not be counted when you call elm_entry_cursor_pos_get(), that is reasonable. Why we need count the cursor position for the invisible contents?

If you really need to translate the cursor position to the really position in the context with markups, you need to implement it by yourself like Colin suggested.

Alex Dem

Hi,
Thank you for responses.
It is needed for markup editor , to detect what we are inside hyperlink (for example) .
Alexey.