Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Carbon Fiber Cases FunkyMonkCP iPhone Accessories 5 Oct 19, 2011 02:47 PM
Most asthetically pleasing carbon fiber skin for the iPad 2 Nykwil iPad Accessories 2 Mar 17, 2011 03:00 PM
SGP Skin Guard Carbon - Finding It Cheaper Than SGPstore Statusnone88 iPhone Accessories 5 Aug 7, 2010 10:55 AM
Need for Speed - Carbon - Graphic Problems biffcliff Mac Applications and Mac App Store 0 Jan 30, 2008 04:51 AM
Wolfenstein is full of Carbon - yuck! blackpeter Games 3 Apr 30, 2002 03:32 PM


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

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

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