Futurebasic/Language/Reference/tehandle

From Wikibooks, open books for an open world
Jump to navigation Jump to search

TEHANDLE[edit | edit source]

Function[edit | edit source]

(+) Appearance (+) Standard Console

Syntax[edit | edit source]

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

Description[edit | edit source]

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).

See Also[edit | edit source]

EDIT FIELD; PICTURE FIELD; WINDOW( _efHandle); Inside Macintosh: Text