cannot copy rawdata to the clipboard

  1. 3 months ago

    Jean-Yves P

    Jan 12 Pre-Release Testers, Xojo Pro Europe (France, Besancon)
    Edited 3 months ago

    Hi everyone,

    I tried to copy some rawdata into the clipboard using the code below.

      Dim c As New Clipboard
      c.SetText mDate.SQLDateTime
      
      Dim s As String = mDate.SQLDateTime
      Dim mb As MemoryBlock
      mb = s
      c.AddRawData mb, "myclipdata"
      c.Close
      

    this code is in the editcopy menu handler.
    I want to copy the mDate as an sqldate in the clipboard
    the text gets copied to the clipboard, but the rawdata gets only the data type entry in the clipboard, and zero data.
    I used clipboardviewer to check that.
    I also tried : c.AddRawData s, "myclipdata" -> same result.

    what did I do wrong ?
    thanks.

    Xojo 2017r3 - MacOS 10.11.6

    From the docs:

    The DataType parameter supports both the older MacType and newer UTIs.

  2. Greg O

    Jan 12 Xojo Inc Answer Somewhere near Raleigh, NC

    From the docs:

    The DataType parameter supports both the older MacType and newer UTIs.

  3. Jean-Yves P

    Jan 12 Pre-Release Testers, Xojo Pro Europe (France, Besancon)

    how can I copy completely pure private row data that does not belong to any UTI ?

  4. Jean-Yves P

    Jan 13 Pre-Release Testers, Xojo Pro Europe (France, Besancon)

    in fact I think I will it like that. this rawdata not in UTI will serve as a flag to me, telling that the data in the clipboard has been made by my app, then I can use the text data.
    thanks Greg.

  5. Emile S

    Jan 13 Europe (France, Strasbourg)

    As you are on macOS, you can use the AppleScript’s Script Editor (Éditeur de Script) using:

    return clipboard info

    to get information of what you have in the Clipboard and add class "<kind>" to get the information for the specific class (you saw in the previous command).

    Apple Link: clipboard info

    In a project, I allow Copy and Paste of what is on screen (TextFields and one Canvas).

    return clipboard info

    gave me:

    {{«class utf8», 66}, {TIFF picture, 390316}, {«class ut16», 134}, {string, 66}, {Unicode text, 132}, {«class 8BPS», 348874}, {GIF picture, 68555}, {«class jp2 », 27948}, {JPEG picture, 30017}, {«class PNGf», 194756}, {«class BMP », 388502}, {«class TPIC», 364699}}

    And:

    return clipboard info for JPEG picture
    {{JPEG picture, 30017}}

    Sorry: I totally forgot (and not found after an extensive search) how to get that particular contents (ie the text in Unicode text for example).

    No need to download or run larger application.
    HTH.

  6. Jean-Yves P

    Jan 13 Pre-Release Testers, Xojo Pro Europe (France, Besancon)

    Emile, ClipboardViewer is a very nice free tool to see all the clipboard content.

    https://developer.apple.com/library/content/samplecode/ClipboardViewer/Introduction/Intro.html

    -image-

or Sign Up to reply!