Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
Source/GetCreator.c
void GetTextItem(DialogPtr theDialog, short itemNumber, Str255 text) |
{ |
Handle iHandle; |
Rect box; |
int iType; |
GetDItem(theDialog,itemNumber,&iType,&iHandle,&box); |
GetIText(iHandle,text); |
} |
#define ASK_ALERT 500 |
#define OK_BTN 1 |
#define CANCEL_BTN 2 |
#define CREATOR_STR 3 |
short GetCreator(char creator[4]) |
{ |
DialogPtr dp; |
short item; |
Str255 createStr; |
short i; |
dp = GetNewDialog(ASK_ALERT,nil,(WindowPtr)-1); |
ModalDialog(nil,&item); |
if(item == CANCEL_BTN) goto bail; |
GetTextItem(dp,CREATOR_STR,createStr); |
if(createStr[0] < 4) { |
Msg("\pYou Must enter at least 4 characters."); |
goto bail; |
} |
for(i = 0; i < 4; i++) |
creator[i] = createStr[i + 1]; |
bail: |
DisposeDialog(dp); |
/* Do three events to update windows behind */ |
MainEvent(); |
MainEvent(); |
MainEvent(); |
return item; |
} |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14