Languages

Menu
Sites
Language
How can I use system clipboard?

Hi,

 I was write the following question, 

 

https://developer.tizen.org/ko/forums/native-application-development/%EC%8B%9C%EC%8A%A4%ED%85%9C-%ED%81%B4%EB%A6%BD%EB%B3%B4%EB%93%9C-%EC%82%AC%EC%9A%A9%EC%97%90-%EA%B4%80%ED%95%98%EC%97%AC?tab=active

 

But I could not get a proper answer,

I want to know whether can use the system clipboard by third-party app.

Thanks.

 

 

Edited by: terry kim on 07 Dec, 2015
View Selected Answer

Responses

11 Replies
Manos Theocharopoulos

Hi,
Try this

//Create an editfield
Evas_Object* editfield = elm_entry_add(m_naviframe);
//Set text
elm_object_text_set(editfield,sqlstatement.c_str());
//Select all
elm_entry_select_all(editfield);
//Copy
elm_entry_selection_copy(editfield);
//Delete the editfield
evas_object_del(editfield);

terry kim

Thanks for your reply,

But, I want to use system clipboard without elm_entry.

Can I do it without elm_entry?

 

I have already test through "Copy and paste" sample, but it was not too into the system clipboard(virtaul clipboard).

Please let me know, if I was wrong.

Thanks.

 

Mark as answer
Mohammad Nur Nobi

You can copy string using elm_cnp_selection_set() API.

Sample Code:

if(elm_cnp_selection_set(parent, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT, "String to be copied", strlen("String to be copied")) == EINA_FALSE)
    ERR("copy data set error!");

terry kim

Thanks for your reply,

I was using wrong option, ELM_SEL_TYPE_PRIMARY.

I had checked that doing well.

Thanks.

 

terry kim

Hi,

elm_cnp_selection_set is doing well,

but I need how to force clipboard show, and paste event connection.

How can I show clipboard, and paste?

Thanks.

Mohammad Nur Nobi

Hello,

If you want to show clipboard and paste message in any specific entry, you then don't need to do anything explicitely.

Just long pressing on the entry will show the System clipboard. And you can select your desired item to paste in the entry.

 

However, if you want fetch data from clipboard programmatically, you can check elm_cnp_selection_get() API.

 

terry kim

Hello, thanks for your reply

I want to use system clipboard without elm_entry because I'm going to develop custom editor.

 

Please let me know how to show the clipboard explicitly and how to detect system clipboard item selected.

If it is impossible, I will remove it.(and I'm developing to tizen 2.4)

 

 

 

 

 

 

Manos Theocharopoulos

As far as I can elm_cnp_selection_set and elm_cnp_selection_get are not documented in Tizen 2.3.x only in 2.4.0.
So it might fail validation for the Z1 for using undocumented API calls.

Mohammad Nur Nobi

Yes it will fail validation for 2.3 NOT for Z1.

Because, Z1 is now available with upgraded OS 2.4.

However, there should have some alternative API for clipboard in 2.3 too.

woochan lee

hello.

tizen clipboard communicate with X server to get a data.

each window has own X window. so cbhm can gives and takes data via X server client system.

 

For handle clipboard, you have to get a cbhm xwindow and send a XClientMessageEvent to cbhm.

Sounds hard... actually It means 3rd party application should not handle cbhm directly...

It may occur a lot of problem, if 3rd party app can handle cbhm.

That's way Tizen doesn't release public cbhm APIs i think. :)

terry kim

hello, 

I understood the difficult points, thanks.