Important: The information in this document is obsolete and should not be used for new development.
TEFeatureFlag
TheTEFeatureFlag
function turns a specified feature on or off or returns the current status of that feature. Features supported are automatic scrolling, text buffering, outline highlighting, inline input, and text services.
FUNCTION TEFeatureFlag (feature: Integer; action: Integer; hTE: TEHandle): Integer;
feature
- The feature for which the action is to be performed.
action
- A selector stipulating that the feature, specified by the
feature
parameter, is to be turned on or off, or that the current status of the feature is to be returned.hTE
- A handle to the edit record for which the action should be performed.
DESCRIPTION
You can use theTEFeatureFlag
function to check the status of additional TextEdit features--automatic scrolling, outline highlighting, and text buffering--and to enable or disable the feature. You can also use this function to disable inline input in a particular edit record and to enable several features that have been provided so that inline input works correctly with TextEdit.To identify a feature, you specify one of the following constants as the value of the
feature
parameter.You specify the
action
to be performed on a feature through the following constants.
Constant Value Description teBitClear 0 Disables the specified feature teBitSet 1 Enables the specified feature teBitTest -1 Returns the current setting of the specified feature If
teBitTest
returnsteBitSet
, the feature is enabled; if it returnsteBitClear
, it is disabled.You can use the
TEFeatureFlag
function to turn automatic scrolling on and off as an alternative to callingTEAutoView
. The effect is the same.The
teFOutlineHilite
selector specifies outline highlighting as the feature for which an action is to be performed. If a highlighted region exists in an edit record and the window is inactive, then the highlighted region is outlined or framed.In the case that outline highlighting is enabled and the current selection range is an insertion point, the caret is then drawn in a gray pattern so that it appears dimmed. To do the framing and caret dimming, TextEdit temporarily replaces the current address in the
highHook
andcaretHook
fields of the edit record, redraws the caret or the highlighted region, and then immediately restores the hooks to their previous addresses.The
teFTextBuffering
selector enables or disables text buffering for performance improvements of 2-byte scripts. This is a global buffer, as opposed to theTEKey
procedure's internal 2-byte buffer, and it is used across all active edit records. When using text buffering, take the following precautions:
If text buffering is enabled on a non-Roman script system and the keyboard has changed, TextEdit flushes the text of the current script from the buffer before bringing characters of the new script into the buffer.
- Exercise care when you enable the text-buffering capability in more than one active record; otherwise, the bytes that are buffered from one edit record may appear in another edit record.
- Ensure that buffering is not turned off in the middle of processing a 2-byte character. To guarantee the integrity of your record, it is important that you wait for an idle event before you disable buffering or enable buffering in a second edit record.
- When text buffering is enabled, ensure that
TEIdle
is called before any pause of more than a few ticks--for example, before the Event Manager procedureWaitNextEvent
. A possibility of a long delay before characters appear on the screen exists, especially in non-Roman systems. If you do not callTEIdle
, the characters can end up in the edit record of another application. For more information, see "TEIdle" on page 2-79.
If your application follows the guidelines for inline input available from Macintosh Developer Technical Support, then you should set the
useTextEditServices
flag in the Size resource in your application. This allows inline input to work with your application. Inline input is a keyboard input method (often used for double-byte script systems) in which conversion from a phonetic to an ideographic representation of a character takes place at the current line position where the text is intended to appear. This allows the user to type text directly in the line as opposed to a special conversion window. If inline input is installed and theuseTextEditServices
flag in the Size resource is set, inline input sets TextEdit'steFUseTextServices
feature bit whenever an edit record is created. TextEdit does not use this bit.Inline input checks the
teFUseTextServices
bit during text editing to determine if an inline session should begin. If you want to disable inline input for a particular edit record, your application can clear this bit after the edit record is created. You can also clear this bit to disable inline input temporarily and then restore it, but the edit record must always be deactivated before the state of the bit is changed.
In the future, other text services may use this same mechanism. If you follow the guidelines specified here, your application should also work with future text services. When an inline edit session begins, inline input also sets the
- IMPORTANT
- You must deactivate an edit record (using
TEDeactivate
) before changing the state of the feature bits or any fields in the edit record.teFInlineInput
bit to provide the following features so that inline input works correctly with TextEdit:
- disabling font and keyboard synchronization
- forcing a multiple-line selection to be highlighted line by line using a separate rectangle for each line rather than using a minimum number of rectangles for optimization
- highlighting a line only to the edge of the text rather than beyond the text to the edge of the view rectangle
To test for the availability of these features, you can call the
- IMPORTANT
- The
teFInlineInput
bit is cleared by inline input when an inline session ends. Use theteFInlineInput
constant in the feature parameter ofTEFeatureFlag
to include these features in your application even when inline input is not installed. Be careful about changing the state of this bit if theteFUseTextServices
bit is set. Again, the edit record should always be deactivated before you change the state of theteFInlineInput
bit. If you clear theteFUseTextServices
bit and you set theteFInlineInput
bit, inline input is disabled, but your application retains the features listed above.Gestalt
function with thegestaltTextEditVersion
selector. A result ofgestaltTE4
or greater returned in the response parameter indicates that outline highlighting and text buffering are available. A result ofgestaltTE5
or greater returned in the response parameter indicates that the two inline input features are available.The inline input features are also available on version 6.0.7 systems with non-Roman script systems installed. However, there is no Gestalt constant that indicates this availability.
SEE ALSO
For a description of theWaitNextEvent
function, see the chapter "Event Manager" in Inside Macintosh: Macintosh Toolbox Essentials.