Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HITextView vs naked TXNObject



On 11/29/04 2:30 PM, David McLeod didst favor us with:

> On Nov 28, 2004, at 6:45 AM, Laurence Harris wrote:
>> On 11/28/04 5:13 AM, Jan Brittenson didst favor us with:
>>> Not only that, but my fields are already checked. :)  The
>>> following in fact works like a charm:
>>> 
>>> Size size;
>>> CFStringRef cfstr;
>>> GetControlData(cref, kControlEditTextPart,
>>> kControlEditTextCFStringTag,
>>> sizeof cfstr, (void*)&cfstr, &size);
>>> 
>> 
>> You can make it a little simpler:
>> 
>> CFStringRef cfstr;
>> GetControlData(cref, kControlEditTextPart, kControlEditTextCFStringTag,
>> sizeof cfstr, (void*)&cfstr, NULL);
>> 
>> since you don't need the size.
> 
> You could also not ignore the return value. At least assert that it is
> noErr in your debug code.

I use this:

OSErr GetText( ControlRef inControl, CFStringRef &outText )
{
    OSErr    err;
    
    if ( inControl )
        err = GetControlData( inControl, kControlEntireControl,
kControlEditTextCFStringTag, sizeof( outText ), &outText, nil );
    else
        err = paramErr;

    if ( err )
        outText = NULL;
        
    return err;    
}

Larry

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: HITextView vs naked TXNObject (From: David McLeod <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.