home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP Advantage
/
NeXTstep_Advantage.img
/
YourCallDemo
/
CallReviewer.m
< prev
next >
Wrap
Text File
|
1993-04-14
|
4KB
|
165 lines
#import "CallReviewer.h"
@implementation CallReviewer : CallController
/*
* Purpose: Initialize the CallReviewer
*
* Inherited from CallController, overridden by CallReviewer
* to prepare the user interface to accept input.
*/
- awakeFromNib
{
[self resetReviewer];
[super awakeFromNib];
return self;
}
/*
* Purpose: Retrieve a call from the database.
*
* Inherited from CallController, overridden by CallReviewer to
* reset the User Interface when the user retrieves a call.
*/
- retrieveCall:sender
{
[self resetReviewer];
[super retrieveCall:sender];
return self;
}
/*
* Purpose: Save the information in the form to the database
*
* Inherited from CallController, overridden by CallReviewer to
* reset the User Interface when the user saves a call.
*
*/
- saveCall:sender
{
if ([super saveCall:sender]) {
[self resetReviewer];
return self;
}
else return nil;
}
/*
* Purpose: Begin a new call entry
*
* Inherited from CallController, overridden by CallReviewer to
* reset the User Interface when the user clears the form.
*
*/
- clearForm:sender;
{
[self resetReviewer];
[super clearForm:sender];
return self;
}
/*
* Purpose: Display a record in the log form
*
* Accepts a CallRecord and displays its data. Used by the
* showNextCall method to display records as the user
* clicks the button in the Review Calls panel.
*/
- showCall:(CallRecord *)theRecord
{
[customerForm setStringValue:[theRecord name] at:0]; // name
[customerForm setStringValue:[theRecord street] at:1]; // street
[customerForm setStringValue:[theRecord city] at:2]; // city
[customerForm setStringValue:[theRecord state] at:3]; // state
[customerForm setStringValue:[theRecord phone] at:4]; // phone
[questionText setStringValue:[theRecord question]];
[answerText setStringValue:[theRecord answer]];
[customerForm selectText:self];
return self;
}
/*
* Purpose: To initialize and present the Review Calls feature
*
* This method displays the review calls panel, resets the
* reviewer, and displays the first call in the database.
* It is sent to CallReviewer by the Review Calls MenuCell.
*
*/
- showFirstCall:sender
{
[reviewCallsPanel makeKeyAndOrderFront:self];
[self resetReviewer];
[self showNextCall:self];
return self;
}
/*
* Purpose: To display the next caller in the database
*
* This method checks the call number being displayed.
* If zero, beeps and no call is displayed.
* Otherwise, gets the record by number from the database
* and displays it in the form.
*
*/
- showNextCall:sender
{
const char *formName = NULL;
CallRecord *currentRecord;
BOOL successful;
if ([callTable count] == 0) {
NXBeep();
return nil;
}
[ofButton setTransparent:NO];
successful = [callTable nextState:&hashState
key:(const void **)&formName
value:(void **)¤tRecord];
if (successful == NO) {
NXBeep();
[self resetReviewer];
[self clearForm:self];
return nil;
}
indexOfCall++;
[callIndexField setIntValue:indexOfCall];
[totalCallsField setIntValue:[callTable count]];
[self showCall:currentRecord];
return self;
}
/*
* Purpose: To reset the Review Calls feature
*
* This method sets the call number to zero and initializes
* Review Calls panel so that the user may begin
* reviewing calls in the database.
*
*/
- resetReviewer
{
indexOfCall = 0;
hashState = [callTable initState];
[callIndexField setStringValue:NULL];
[totalCallsField setIntValue:[callTable count]];
[ofButton setTransparent:YES];
return self;
}
@end