Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Image from NSTextView

Image from NSTextView
Thread Tools
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Apr 7, 2004, 12:28 AM
 
Hi,

I searched the docs, but couldn't figure out how to do this:

I need to get an image out of an NSTextView if the user drags one in. Does anyone have any suggestions?

TIA,
Ian
     
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Apr 7, 2004, 05:31 PM
 
For the reference, this is what I got elsewhere:

Attachments are stored in the text storage as NSAttachmentCharacter with the attribute NSAttachmentAttributeName, whose value is the NSTextAttachment object. The NSTextAttachment in turn has the contents of the attached file (in its fileWrapper) and also a cell used to represent it visually (its attachmentCell). If the text system recognizes the file as an image file, then it will automatically create an appropriate attachment cell and assign to it an image created from that file. If the text system does not recognize the file format, then it will automatically create an appropriate attachment cell and assign to it a suitable icon image representing the file. What you should do depends on whether you are looking for the image or for the contents of the file.


One last question, how do I make a "NSRangePointer"?
     
Professional Poster
Join Date: Apr 2001
Location: Long Beach, CA
Status: Offline
Reply With Quote
Apr 7, 2004, 09:46 PM
 
Originally posted by macrophyllum:
One last question, how do I make a "NSRangePointer"?

That should be:

NSRange theRange;

&theRange <--this is an NSRangePointer, according to the documentation.

NSRange is a C struct:



typedef struct _NSRange {
unsigned int location;
unsigned int length;
} NSRange;

typedef NSRange *NSRangePointer;

ACSA 10.4/10.3, ACTC 10.3, ACHDS 10.3
     
   
Thread Tools
Forum Links
Forum 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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:06 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2