qPCR4vir / nana

a modern C++ GUI library
http://nanapro.org
Boost Software License 1.0
16 stars 2 forks source link

How to put text in clipboard? #23

Closed qPCR4vir closed 9 years ago

beru commented 9 years ago

I can copy the value of a textbox by pressing Ctrl+C keys. Do you mention API? nana library uses #include <nana/system/dataexch.hpp> Here is an excerpt code from text_editor.cpp

void text_editor::copy() const
{
    nana::string str;
    if(_m_make_select_string(str))
        nana::system::dataexch().set(str);
}
qPCR4vir commented 9 years ago

Thank! Yes. I know the "copy" from textbox. But the lower level '''nana::system::dataexch().set(str);''' is a good hint. I was thinking in copying to the clipboard selected rows from a listbox. Probably I can paste a .csv string in an excel sheet or a text editor, and this can be a simple alternative to implement .csv export from my tables.

void listbox::copy() const
{
    nana::string str{to_csv()};
        nana::system::dataexch().set(str);
}
qPCR4vir commented 9 years ago

Using the Clipboard GlobalAlloc function GlobalLock function SetClipboardData function Standard Clipboard Formats Clipboard Formats Synthesized Clipboard Formats

[]()