The application may choose to control the editing features provided in string gadgets used within the application. to locally install the custom string editing features, the application provides a hook in the stringextend structure edithook field. A hook is a well defined calling interface for a user provided subroutine or function. Hooks are more fully described in the "utility library" chapter. A string gadget hook is called in the standard way, where the hook object is a pointer to a sgwork structure, and the hook message is a pointer to a command block. However, unlike a function callback hook, a string gadget editing hook is called on Intuition's task context, not on the application's own context. Therefore, a string gadget editing hook must not use dos.library, and may not wait() on application signals or message ports, and may not call any Intuition function which might wait for Intuition. The command block starts with either (longword) sgh_key or sgh_click. There may be new commands added in the future, so the application should not assume that these are the only possible commands. The hook should return zero if it doesn't understand the command and non-zero if the command is supported. The sgwork structure, defined in <intuition/sghooks.h>, is listed on the next page. Use this structure as the hook object for custom string editing hooks. sgwork structure actions with sgh_key editop definitions the sgh_click command actions definitions actions with sgh_click the sgh_key command example string gadget editing hook