[futurebasic] Using The Clipboard

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 2011 : Group Archive : Group : All Groups

From: Warren Lanford <wdllien@...>
Date: Sun, 27 Mar 2011 18:32:06 -0400
Hi Deep
Hi Brian

Thanks to both of you for the reply.

Brain says we're not supposed to use Gworlds any longer.  I had not  
seen anything about that before.

If we don't use Gworlds, what are we supposed to be using to work with  
images?  I know of no other way to work with parts of and image or to  
change many aspects of an image.

Now to the example. 
    

I did find this before, but it didn't seem to apply to an image as  
such.  It creates something that's tied to a "pdf" file on the  
clipboard that can be pasted into an application like TextEdit that  
behaves like text.
But I don't think it's an image.

I tried then to use this as a template to work with but could not come  
up with anything that worked.

After your post I went back and tried again.  Below is my fn to copy a  
portion of an image in a Gworld and then copy it to the clipboard or  
"Pasteboard".  But.  I cannot figure out how to make it work that  
doesn't create a problem.

This is the original line.
err = fn PasteboardPutItemFlavor( myPasteBoard, 1, fn  
CFSTR( "com.adobe.pdf" ), pdfData, _kPasteboardFlavorNoFlags )

This seems to want to tie a string to the Copy.  There is no string  
associated with a copied image that I've ever heard of.


local
dim as OSStatus             err
dim as PasteBoardRef  myPasteBoard
dim bytes&
dim as handle                 pic
local fn DoCopy
   call setgworld(GWorld1, 0)
   pic = fn GetPict( gUndoRect )
   call setgworld(gScreenGW, 0)
   long if pic
     err = fn PasteboardCreate( kPasteboardClipboard, @myPasteBoard )
     long if ( err == _noErr )
     bytes& = fn  
gethandlesize(pic)                                                     
'get picture size
     fn PasteboardClear( myPasteBoard )
     err = fn PasteboardPutItemFlavor( myPasteBoard, 1,pic, ,  
_kPasteboardFlavorNoFlags )
     CFRelease( myPasteBoard )
   end if
   fn disposeh(pic) : pic = 0
end if
fn DropMarquee
window output _MainWind
call invalrect(gScrnRect)
end fn


using this :
     err = fn PasteboardPutItemFlavor( myPasteBoard, 1,pic, ,  
_kPasteboardFlavorNoFlags )
I get
Error: •• Bad factor in expression in line 39 of NS4 80.incl: ''
  39:  err = fn PasteboardPutItemFlavor( myPasteBoard, 1,pic, ,  
_kPasteboardFlavorNoFlags )
                                                                                                                                                                  ^
using this  :
     err = fn PasteboardPutItemFlavor( myPasteBoard, 1, , pic,  
_kPasteboardFlavorNoFlags )
I get
Error: •• Bad factor in expression in line 39 of NS4 80.incl: ''
  39:  err = fn PasteboardPutItemFlavor( myPasteBoard, 1, ,pic,  
_kPasteboardFlavorNoFlags )
                                                                                                            ^
Sorry, but I just cannot figure out how to make that example translate  
to something that works an image.

Thanks again.

Warren Lanford




Attachments: