Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » Mac OS » Clipboard Usage (I am experiencing difficulties in using the clipboard on macOS.)
Re: Clipboard Usage [message #60419 is a reply to message #60409] Fri, 05 January 2024 22:17 Go to previous message
Klugier is currently offline  Klugier
Messages: 1077
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello RichardMarks,

I am not very familiar with Clipboard, but I can assure you that it works. I tested it by copying text from TheIDE to Microsoft Word. I think the method you just mentioned is checking whenever top entry in clipboard is raw text or not. Please keep in mind that there are multiple functions related to clipboard (CtrlCore/CtrlCore.h file - line 1759 to 1817):
void    ClearClipboard();
void    AppendClipboard(const char *format, const byte *data, int length);
void    AppendClipboard(const char *format, const String& data);
void    AppendClipboard(const char *format, const Value& data, String (*render)(const Value& data));
void    AppendClipboard(const char *format, const ClipData& data);
void    AppendClipboard(const VectorMap<String, ClipData>& data);
String  ReadClipboard(const char *format);
bool    IsClipboardAvailable(const char *format);

inline  void WriteClipboard(const char *format, const String& data)
	{ ClearClipboard(); AppendClipboard(format, data); }

void    AppendClipboardText(const String& s);
String  ReadClipboardText();
void    AppendClipboardUnicodeText(const WString& s);
WString ReadClipboardUnicodeText();
bool    IsClipboardAvailableText();

inline  void WriteClipboardText(const String& s)
	{ ClearClipboard(); AppendClipboardText(s); }
inline  void WriteClipboardUnicodeText(const WString& s)
	{ ClearClipboard(); AppendClipboardUnicodeText(s); }

template <class T>
inline void AppendClipboardFormat(const T& object) {
	AppendClipboard(typeid(T).name(), StoreAsString(const_cast<T&>(object)));
}

template <class T>
inline void WriteClipboardFormat(const T& object) {
	ClearClipboard();
	AppendClipboardFormat(object);
}

template <class T>
inline bool ReadClipboardFormat(T& object)
{
	String s = ReadClipboard(typeid(T).name());
	return !IsNull(s) && LoadFromString(object, s);
}

template <class T>
bool IsClipboardFormatAvailable()
{
	return IsClipboardAvailable(typeid(T).name());
}

template <class T>
inline T ReadClipboardFormat() {
	T object;
	ReadClipboardFormat(object);
	return object;
}

Image  ReadClipboardImage();
void   AppendClipboardImage(const Image& img);

inline void WriteClipboardImage(const Image& img)
	{ ClearClipboard(); AppendClipboardImage(img); }

Unfortunately above code is undocumented, but you might learn a lot only from reading functions declaration. Please let me know if it helps.

Klugier


U++ - one framework to rule them all.

[Updated on: Fri, 05 January 2024 22:18]

Report message to a moderator

 
Read Message
Read Message
Previous Topic: Undefined symbols for architecture arm64
Next Topic: Error building upp on Ventura
Goto Forum:
  


Current Time: Fri Jul 12 12:07:06 CEST 2024

Total time taken to generate the page: 0.01469 seconds