Hot Door CORE Forum

Full Version: Clipboard Access - Managing Users Clipboard Data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

things are going super well, i have a working plugin and am tracking selected items and colors on the document.

i wanted to see if anyone have any insight into reading data on the users clipboard ? i am trying to get a value from it to build different items, read from it and create new data that is formatted on their clipboard.

i have tried using the ClipboardData class on HDC but cannot seem to get it to work properly. not sure if you have a better example or maybe i am just missing something, but i cannot figure out how to get the string that is on the clipboard.

i think maybe its something to do with the class itself, or maybe i am just missing something.

thanks all !!
Here's how I get string data from the clipboard:


Code:
hdi::core::ClipboardData cbData;
std::string str;
if (hdi::core::clipboardData(cbData)
&& cbData.dataType() == hdi::core::ClipboardData::DataTypeString){
str = cbData.stringData();
}


To put string data onto the clipboard:

Code:
hdi::core::setClipboardData(str);

Maybe these techniques are not technically correct, but have been working well for me.
(04-12-2022, 10:11 AM)Rick Johnson Wrote: [ -> ]Here's how I get string data from the clipboard:


Code:
hdi::core::ClipboardData cbData;
std::string str;
if (hdi::core::clipboardData(cbData)
&& cbData.dataType() == hdi::core::ClipboardData::DataTypeString){
str = cbData.stringData();
}


To put string data onto the clipboard:

Code:
hdi::core::setClipboardData(str);

Maybe these techniques are not technically correct, but have been working well for me.


Confirmed!! This is working well for me. I am able to set this data and then also with some other work i have been able to set the data, pull data off of the clipboard, modify it, and then reattach it back to the clipboard without losing the integrity of the data. 

Very happy and thanks for your help!!