Futurebasic/Language/Reference/tehandle

= TEHANDLE =

Function
(+) 	Appearance 		(+) 	Standard 			Console

Syntax
editFieldHandle& = TEHANDLE(fieldID) fieldInfo = TEHANDLE(-fieldID)

Description
This function returns information about an edit field or picture field in the current output window. If you use the first syntax (passing a positive value to TEHANDLE), TEHANDLE returns a handle to the TextEdit record associated with the specified field. Although a valid handle will also be returned for picture fields, this is really more useful in the case of edit fields. The following table lists some of the more useful elements that can be found in the field's TextEdit record. The syntax shown in the table assumes that the value returned by TEHANDLE has been assigned to a long integer variable teH&. IMAGE imgs/TEHANDLE_function02.gif (Note: for a description of other elements in the TextEdit record, see the "TextEdit" chapter in Inside Macintosh: Text.) If you use the second syntax (passing a negative value to TEHANDLE), TEHANDLE returns a value identifying the field's type, as follows: IMAGE imgs/TEHANDLE_function04.gif Example: This function returns the next available ID number that is not currently being used by any picture field or edit field in the current window. LOCAL FN GetUnusedFieldID DIM id  id = 0 DO INC(id) UNTIL TEHANDLE(-id) = 0 END FN = id Note: You should generally not alter the contents of a TextEdit record directly. Use TextEdit Toolbox routines, or FB statements like EDIT FIELD, to alter the characteristics of the field. If you use TEHANDLE to get a TextEdit record handle, you should not dispose of the handle. The memory associated with the edit field is automatically disposed when you close the edit field (using EDIT FIELD CLOSE) or close its window (using WINDOW CLOSE).