sometimes in a clipboard there are multiples items for representing a single value.
if you copy styled text, you have the styled text, but also the rtf or even the raw text in the clipboard.
how do you loop through all the items in the clipboard to choose the one you need ( to paste)
it seems the clipboard.rawdataavailable only checks the first item type
also clipboard.pictureavailable seems to returns false if the image type (jpg,png, or tiff) is not in the first position ?
is there a way to do this, just like you can do it with dragitems.
When I do not know how to ask, I ask what I think I have to do. In this case the question is wong and have this answer (to be refined with the kind of data you want to get back and it depends n the Platform).
I once get a totally different answer (regarding what I asked), and that was the correct answer, my question was not right (plain wrong, but the answer guy understoud what I wanted)…
[quote=449337:@Emile Schwarz]When I do not know how to ask, I ask what I think I have to do. In this case the question is wong and have this answer (to be refined with the kind of data you want to get back and it depends n the Platform).
I once get a totally different answer (regarding what I asked), and that was the correct answer, my question was not right (plain wrong, but the answer guy understoud what I wanted)…[/quote]
The clipboard class in xojo is too basic to do something like that. You have to use Declares:
To summarize, there is no way to loop through all of the RawData stored in the clipboard with basic Xojo support. You need to get a list of the identifiers and check them using RawDataAvailable(Identifier), preferably in the order in which you would like to use them, until you find a suitable match. Then you’ll use RawData(Identifier) to retrieve the content for that identifier. Note that these identifiers will be different by platform. Just as an example:
On Windows, HTML is under the identifier “text/html”
On macOS, HTML is under the identifier “public.html”
I don’t think I’ve ever seen this issue. I’d open a Feedback Report.
Same answer: the developer (Xojo developer) ask the OS the kind of object (Text or Picture) he want and the OS returns it if it exists in the Clipboard.[/quote]
I do believe they’re saying that there’s a picture object in the clipboard, but PictureAvailable is reporting false if something else is stored in the clipboard under a different identifier as well. This would be a bug.
You can add in the CLipboard a Text, a Picture, A Sound, (etc.) all at once. When you are not in charge of the development: say you use a text editor, the Text contents of the Clipboard will bepasted in the window.
Same apply for the Picture, Sound, etc.
There is no I return the first object I have in the Clipboard here.
If your application is in charge of the Clipboard and can deal with all of the above and there is all of the above: I do not knowwhat will be pasted, but I never get that in real life.
a after testing, if you can prove what you wrote, of course you can write a bug report,
b this is my experience based on more than 40 years of computing use. But I can be wrong, as some already understand using Cataline (as recent Conversations here shows).
I’m going off of his statement that having multiple types of data stored, one of them being a picture, PictureAvailable returns False. I’m not sure what you’re driving at, but I’m just going to see myself out. Have fun.
to be clear.
I have a clipboard with “com.company.whatever”, then “public.tiff”, then “Next TIFF v4”
I want the tiff
if I ask c.pictureavailable I get false
if I ask rawdataavailable(“public.tiff”) I get false …
so I was hoping to be able to loop through the content of the clipboard.
AFAIK, not really. But you can f.e. “store” RTF Text in the Clipboard and some OS will offer to “retrieve” it as RTF and as Plain Text f.e. There may be more cases which behave like this. But you App can only “store” 1 kind of object at once and multiple in multiple “store” tasks.
If the OS supports it or if an App is tied to the System Clipboard and stores each new item in a “cache”, the OS or the App can offer more then just the latests stored item.