4D v13.4Pasteboard data size |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
Pasteboard data size
Pasteboard data size
The Pasteboard data size command checks whether there is any data of the type you passed in dataType present in the pasteboard. Note: In the case of copy/paste operations, the pasteboard is equivalent to the Clipboard. If the pasteboard is empty or does not contain any data of the specified type, the command returns an error -102. If the pasteboard contains data of the specified type, the command returns the size of this data, expressed in bytes. In dataType, pass a value specifying the type of data to be checked for. You can pass a 4D signature, a UTI type (Mac OS), a format name/number (Windows), or a 4-character type (compatibility). For more information about these types, please refer to the Managing Pasteboards section. After you have detected that the pasteboard contains data of the type in which you are interested, you can extract that data from the pasteboard using one the following commands:
The following code tests whether the pasteboard contains a jpeg picture and, if so, copies that picture into a 4D variable: If(Pasteboard data size("com.4d.private.picture.jfif")>0) ` Is there a jpeg picture in the pasteboard? Usually, applications cut and copy Text or Picture type data into the pasteboard, because most applications recognize these two standard data types. However, an application can append to the pasteboard several instances of the same data in different formats. For example, each time you cut or copy a part of a spreadsheet, the spreadsheet application could append the data under the hypothetical ‘SPSH’ format, as well as in SYLK and TEXT formats. The ‘SPSH’ instance would contain the data formatted using the application’s data structure. The SYLK form would contain the same data, but using the SYLK format recognized by most of the other spreadsheet programs. Finally, the TEXT format would contain the same data, without the extra information included in the SYLK or the hypothetical ‘SPSH’ format. At this point, while writing Cut/Copy/Paste routines between 4D and that hypothetical spreadsheet application, assuming you know the description of the ‘SPSH’ format and that you are ready to parse SYLK data, you could write something like: Case of In other words, you try to extract from the pasteboard the instance of the data that carries most of the original information. See the example for the APPEND DATA TO PASTEBOARD command. |
PROPERTIES
Product: 4D
INDEX HISTORY
Modified: 4D v11 SQL SEE ALSO
GET PASTEBOARD DATA |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||