Release 1.0  Copyright ã1994 by M. Onyschuk and Associates Inc.  All Rights Reserved.

OATextFieldFormatter

Inherits From:	Object

Declared In:	<OATextField/OATextFieldFormatter.h>

Class Description

OATextFieldFormatter is a kind of object which defines additional formatting behavior of an OATextFieldCell, both during data entry as well as after data entry is complete. The OATextFieldFormatter class abstracts the concept of Text field filters employed by Text objects during data entry, allowing programmers to write more powerful filters more easily.

OATextFieldFormatter defines three methods to be overridden by programmers; -filterSubstring:ofSize:at: which is called after each character entered by users during data entry, -formatString: which is called after data entry is complete, and -setTextFieldCell:which is called just after an OATextFieldCell receives a -setTextFieldFormatter: message.

Creating a custom formatter involves overriding the three methods mentioned above, and using three other utility methods to set the filtered output value generated by the receiver; -setOutput: and setOutputNoCopy: set formatter output to a C style string, and -setOutputFormat: which sets formatter output using printf style arguments.

Instance Variables

char *output;

output	No description.

Method Types

	- filterSubstring:ofSize:at:
	- formatString:
	- free
	- output
	- setOutput:
	- setOutputFormat:
	- setOutputNoCopy:
	- setTextFieldCell:

Instance Methods

filterSubstring:ofSize:at:
-  filterSubstring:(unsigned char *)inputText
ofSize:(int)inputSize
at:(int)position

Sets the receiver's output to the value inputText. Subclasses should override this method to set output to a different value.  This method is called as data entry is in progress.

See also:  -setOutput, -setOutputNoCopy:, -setOutputFormat:, -output

formatString:
-  (BOOL)formatString:(unsigned char *)inputText

Sets the receiver's output to the value inputText and returns NO. Subclasses should override this method to set output to a different value, or to return YES and cause the OATextField to reject its input. This method is called after data entry is complete.

See also:  -setOutput:, -setOutputNoCopy:, -setOutputFormat:, -output

free
-  free

Frees the receiver.

See also:  

output
-  (const char *)output

Returns the output generated as a result of the receiver's last -filterSubstring:ofSize:at: or -formatString: method.

See also:  -filterSubstring:ofSize:at:, -formatString:

setOutput:
-  setOutput:(const char *)aValue

Sets the output generated by the receiver as a result of the last invocation of its -filterSubstring:ofSize:at: or -formatString: methods. This method takes a copy of aValue, and invokes its own -setOutputNoCopy: method with the copy created.

See also:  -filterSubstring:ofSize:at:, -formatSubstring:, -setOutputNoCopy:

setOutputFormat:
-  setOutputFormat:(const char *)format, ...

Sets the output generated by the receiver as a result of the last invocation of its -filterSubstring:ofSize:at: or -formatString: methods. This method invokes its own -setOutput: method with the string built using the printf style fomratting arguments provided by the user.

See also:  -setOutput:

setOutputNoCopy:
-  setOutputNoCopy:(const char *)aValue

Sets the output generated by the receiver as a result of the last invocation of its -filterSubstring:ofSize:at: or -formatString: methods.

See also: -setOutput:, -setOutputFormat:  

setTextFieldCell:
-  setTextFieldCell:aCell

Does nothing. Subclasses should override this method to set aCell's options to those compatible with the receiver. aCell will subsequently pre-filter input provided to the receiver both during and after data entry.