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 > 2 Problems: Unicode and NSTextField

2 Problems: Unicode and NSTextField
Thread Tools
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jul 17, 2001, 07:13 AM
 
Hello ...

Problem 1: Unicode

I'm trying to install a number of Unicode characters (specified by their hexadecimal codes) into a field. In some cases, there's a long, long, *long* delay between the actual installation and the final "display", and Project Builder announces:

ATSFontLoadUnicodeCharacterSet failed: error -982

The hangup seems to occur when the my method runs across the occasional apparently-missing glyph. (The result is displayed as an "L" in a box in "Helvetica Neue".) A similar delay occurs when I try to scroll a text view with previously-obscured characters; again, it seems that displaying the characters is the problem.

How do I combat this problem?


Problem 2: NSTextField

I have a single-line, left-justified, editable-and-selectable, scrollable NSTextField, right off of the Interface Builder palette. As expected, if I type a long stream of characters into it to the point of going past the right-hand-edge, the string scrolls leftward so that the new characters are still visible. However, I can't get this behavior when I append characters programmatically. Have I simply overlooked a "scrollRangeToVisible" variant (it wouldn't be the first time, but I've think I've looked just about everywhere and tried just about everything), or do I have to fuss with the window's field editor or a custom NSText object?


Thanks and regards,

DayLateDon
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
Jul 22, 2001, 11:50 PM
 
Originally posted by DayLateDon:
<STRONG>Problem 1: Unicode

I'm trying to install a number of Unicode characters (specified by their hexadecimal codes) into a field. In some cases, there's a long, long, *long* delay between the actual installation and the final "display", and Project Builder announces:

ATSFontLoadUnicodeCharacterSet failed: error -982

The hangup seems to occur when the my method runs across the occasional apparently-missing glyph. (The result is displayed as an "L" in a box in "Helvetica Neue".) A similar delay occurs when I try to scroll a text view with previously-obscured characters; again, it seems that displaying the characters is the problem.

How do I combat this problem?
</STRONG>
Ick. Provide a font that has the glyphs? Make sure the character is a valid Unicode value ([NSCharacterSet illegalCharacterSet] and/or [NSCharacterSet nonBaseCharacterSet])?

I suppose you could break in the debugger or examine the running app with Sampler to see what's going on during the delay. However, some fonts just take a while to load...


<STRONG>Problem 2: NSTextField

I have a single-line, left-justified, editable-and-selectable, scrollable NSTextField, right off of the Interface Builder palette. As expected, if I type a long stream of characters into it to the point of going past the right-hand-edge, the string scrolls leftward so that the new characters are still visible. However, I can't get this behavior when I append characters programmatically. Have I simply overlooked a "scrollRangeToVisible" variant (it wouldn't be the first time, but I've think I've looked just about everywhere and tried just about everything), or do I have to fuss with the window's field editor or a custom NSText object?
</STRONG>
If the user is not editing the textfield at the time, there is no way to change the characters being shown -- you *do* have it set as left-justified. You can right-justify it maybe, though editable right-justified textfields have some weirdnesses IIRC. Or you could write a subclass of NSTextFieldCell to do the display a bit differently I suppose.

If the user is editing the field at the moment, then get the window's fieldEditor, and append the string to that and use scrollRangeToVisible.
It *should* work, though I don't know if I've ever tried something like that.
     
   
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:42 AM.
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