home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************************/
- /* */
- /* Module Name: CallbackClear */
- /* */
- /* File Name: CallbackClear.c */
- /* */
- /* © Apple Computer, Inc. 1991-1995 */
- /* All Rights Reserved */
- /* */
- /* Revision History: */
- /* */
- /* Date Who Modification */
- /* */
- /* 1991-08-05 Chris Halim Original version */
- /* 1994-10-26 Jaakko Railo Version 2.0 */
- /* */
- /************************************************************************************************/
-
- /****************************************** DESCRIPTION ******************************************
-
- *************************************************************************************************/
-
- /******************************************** HEADERS *******************************************/
-
- #include "TextUtils.h"
-
- #include "TestModule.h"
-
- /****************************************** DEFINITIONS *****************************************/
-
- #define rCallbackClearDLOG 10000
- #define kCBRef 3
-
- /****************************************** PROTOTYPES ******************************************/
-
- short GetCBRef (short * cbRef);
- void DoTest (CHRSPtr paramPtr);
-
- /************************************************************************************************/
- /************************************************************************************************/
-
-
- pascal short TestModule (CHRSPtr paramPtr)
- {
- short returnValue = noErr;
-
- if (paramPtr->version <= kTestModuleVersion) {
-
- DoTest (paramPtr);
-
- }
- else
- returnValue = kWrongVersion;
-
- return (returnValue);
- }
-
-
- short GetCBRef (short * cbRef)
- {
- short itemKind;
- Handle itemHand;
- Rect itemRect;
- short itemHit;
- DialogPtr theDialog;
- Str255 itemStr;
- long tlong;
-
- if ((theDialog = GetNewDialog (rCallbackClearDLOG, nil, (WindowPtr)(-1L))) != nil) {
- GetDItem (theDialog, kCBRef, &itemKind, &itemHand, &itemRect);
- SelIText (theDialog, kCBRef, 0, 32767);
-
- ShowWindow (theDialog);
-
- ModalDialog (nil, &itemHit);
-
- if (itemHit == ok) {
- GetDItem (theDialog, kCBRef, &itemKind, &itemHand, &itemRect);
- GetIText (itemHand, itemStr);
- StringToNum (itemStr, &tlong);
- *cbRef = tlong;
- }
-
- DisposeDialog (theDialog);
- }
- else
- itemHit = -1;
-
- return (itemHit);
- }
-
-
- void DoTest (CHRSPtr paramPtr)
- {
- TELHandle termHand = GetCurrentTELHandle (paramPtr);
- short itemHit, cbRef;
- OSErr errCode;
-
- if ((itemHit = GetCBRef (&cbRef)) == ok) {
-
- if ((errCode = TELCallbackClear (termHand, cbRef)) == noErr)
- Print (paramPtr, "TELCallbackClear is called successfully");
- else
- Print (paramPtr, "### TELCallbackClear failed : %d", errCode);
- }
- else
- if (itemHit == -1)
- Print (paramPtr, "### Unable to get a DLOG resource");
- }
-
-
-