Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Q&As > Carbon > Human Interface Toolbox >

Why doesn't my Scrolling Text Box control work in a compositing window?


Q: Why doesn't my Scrolling Text Box control work in a compositing window?

A: Some old controls do not work properly in the new compositing windows introduced in Mac OS X 10.2. Some of those controls (ie. Databrowser) were updated in Mac OS X 10.3 so they would work, but others which were not as popular with developers or could be replaced with other solutions, were not updated.

The Scrolling Text Box control (CDEF 27) is resource-based and the modern Mac OS X APIs tend to opt for other means of storage.

The sample code HIScrollingTextBox provides two different replacement APIs for this control:



Listing 1. HICreateScrollingTextBox.


extern OSStatus 
HICreateScrollingTextBox(
    const HIRect * inBounds,                   /* can be NULL */
    CFStringRef    inScrollingText,
    Boolean        inAutoScroll,
    UInt32         inDelayBeforeAutoScroll,
    UInt32         inDelayBetweenAutoScroll,
    UInt16         inAutoScrollAmount,
    HIViewRef *    outHIView);



This API, which can be used on Mac OS X 10.2 and later, uses the same parameters as CreateScrollingTextBoxControl except for the unnecessary WindowRef parameter and the resource ID number replaced by a CFStringRef .



Listing 2. HICreateScrollingHITextBox.


extern OSStatus 
HICreateScrollingHITextBox(
    const HIRect * inBounds,                   /* can be NULL */
    CFURLRef       inURLRef,
    Boolean        inAutoScroll,
    UInt32         inDelayBeforeAutoScroll,
    UInt32         inDelayBetweenAutoScroll,
    UInt16         inAutoScrollAmount,
    HIViewRef *    outHIView);



This API, which can be used on Mac OS X 10.3 and later, uses the same parameters as CreateScrollingTextBoxControl except for the unnecessary WindowRef parameter and the resource ID number replaced by a CFURLRef . This CFURLRef can, for example, point to a .rtf file such as created by TextEdit.


[Nov 13, 2003]