Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 11, 2008, 06:22 PM   #1
john903
macrumors member
 
Join Date: Apr 2008
Carbon - Pasteboard

How do you copy and paste plain text into the pasteboard? I'm using Carbon. Any code examples would be appreciated.

Thanks!
john903 is offline   0 Reply With Quote
Old Apr 12, 2008, 08:35 AM   #2
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
Apple has plenty of documentation on this:

http://developer.apple.com/documenta...section_1.html
kainjow is offline   0 Reply With Quote
Old Apr 24, 2008, 08:22 PM   #3
john903
Thread Starter
macrumors member
 
Join Date: Apr 2008
Yes, but I'm just looking for some sample code and the api looks like a lot to wade though. I just need two simple functions to put and get text from the pasteboard. I would greatly appreciate any code!

Thanks!
john903 is offline   0 Reply With Quote
Old Apr 24, 2008, 08:26 PM   #4
lee1210
macrumors 68040
 
lee1210's Avatar
 
Join Date: Jan 2005
Location: Dallas, TX
http://developer.apple.com/samplecod...id/DTS10000672
lee1210 is offline   0 Reply With Quote
Old Apr 24, 2008, 10:47 PM   #5
john903
Thread Starter
macrumors member
 
Join Date: Apr 2008
I've seen that one. I'm new to Mac programming and the code is very dense for me. I'm working on a cross-platform project that uses GLUT but I still need to do a few OS specific things like copy and paste text. It was easy to implement in Windows but it's eluding me on Mac... Thanks for the help.
john903 is offline   0 Reply With Quote
Old Apr 25, 2008, 08:22 AM   #6
krye
macrumors 68000
 
krye's Avatar
 
Join Date: Aug 2007
Location: USA
Quote:
Originally Posted by kainjow View Post
Apple has plenty of documentation on this:

http://developer.apple.com/documenta...section_1.html
BABY RUTH!!!! Sorry. I saw the picture of Sloth and I couldn't help it.
krye is offline   0 Reply With Quote
Old Apr 28, 2008, 05:45 PM   #7
john903
Thread Starter
macrumors member
 
Join Date: Apr 2008
I got the first part working so I am able to copy text into the pasteboard.

I can't get my code working where I retrieve the text from the pasteboard. Here is the first part of the code. It fails at PasteboardSynchronize giving me the PasteboardOutOfSync error. Do I need to get a reference to the pasteboard some other way when retrieving text from the pasteboard?

Code:
OSStatus err = noErr;
PasteboardRef inPasteboard;
PasteboardCreate(kPasteboardClipboard, &inPasteboard);
	
PasteboardSyncFlags syncFlags;
ItemCount itemCount;
	
syncFlags = PasteboardSynchronize( inPasteboard );
require_action( syncFlags&kPasteboardModified, PasteboardOutOfSync, err = badPasteboardSyncErr );
john903 is offline   0 Reply With Quote
Old Apr 28, 2008, 06:56 PM   #8
john903
Thread Starter
macrumors member
 
Join Date: Apr 2008
Ok, I just commented out the PasteboardSynchronize and it works. I got the code here so I guess if you are using this code outside of an event you don't need that call.
http://developer.apple.com/documenta...section_6.html
john903 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Carbon Skin? Ncage1974 MacBook Pro 2 Feb 28, 2014 05:51 PM
Bodyguardz carbon fiber skin vs. Ghost Armor Carbon fiber skin estestyler26 iPhone Accessories 4 May 7, 2013 09:18 PM
Carbon Skin? Ncage1974 MacBook Air 7 Mar 12, 2013 12:41 AM
Any good pasteboard / clipboard application to recommend? SunnyStudioNeo Mac Applications and Mac App Store 2 Oct 8, 2012 08:17 AM

Forum Jump

All times are GMT -5. The time now is 10:26 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC