LEditField is a PowerPlant class that encapsulates the behavior of an editable text field, as commonly appears in a dialog box.
Methods :
The methods in this class are:
Data Members:
The data members in this class are:
Operation:
LEditField uses TextEdit to implement an editable text field. PowerPlant also handles undo and redo for most text-related actions.
Source files:
Ancestors:
Purpose:
The constructors create objects from the passed-in parameters.
Access:
Prototype:
LEditField();
LEditField( const LEditField &inOriginal );
LEditField( const SPaneInfo &inPaneInfo,
Str255 inString,
ResIDT inTextTraitsID,
SInt16 inMaxChars,
Boolean inHasBox,
Boolean inHasWordWrap,
KeyFilterFunc inKeyFilter,
LCommander *inSuper );
LEditField( const SPaneInfo &inPaneInfo,
Str255 inString,
ResIDT inTextTraitsID,
SInt16 inMaxChars,
UInt8 inAttributes,
KeyFilterFunc inKeyFilter,
LCommander *inSuper );
LEditField( LStream *inStream );Parameters:
The parameters for these constructors are:
Purpose:
The destructor destroys the object.
Access:
Prototype:
virtual ~LEditField();
Purpose:
EditField uses the standard I-Beam cursor. This is an override of AdjustCursorSelf() in LPane.
Purpose:
Adjust the width of the destination rectangle of the Toolbox TextEdit record.
This function does nothing if mHasWordWrap is true. If mHasWordWrap is false, this function sets the width of the TextEdit destination rectangle
to either the width of the text or a very large number, depending
on the value of inShrinkToText.
This adjustment is needed to make autoscrolling work properly when mHasWordWrap is off. While entering text, the destination rectangle should be very wide so that the text doesn't word wrap. However, while clicking, it should be just as wide as the text so that the EditField does not autoscroll past the edge of the text.
Access:
Prototype:
virtual void AdjustTextWidth(Parameters:
Boolean inShrinkToText );
The parameter for this method is:
Return:
Purpose:
Align the view and destination rectangles of the Toolbox TextEdit record with the Frame of an EditField.
Access:
Prototype:
virtual void AlignTextEditRects();Parameters:
Return:
Purpose:
EditField is becoming the Target. This is an override of BeTarget() in LCommander.
Purpose:
Respond to Click inside an EditField. This is an override of ClickSelf() in LPane.
Purpose:
Disable an EditField. This is an override of DisableSelf() in LPane.
Purpose:
EditField is becoming the Target. This is an override of DontBeTarget() in LCommander.
Purpose:
Draw a box around an EditField.
Access:
Prototype:
virtual void DrawBox();Parameters:
Return:
Remarks:
Box around an EditField is outset from the Text by 2 pixels. The box itself is 1 pixel thick, drawn in the foreground color of the Pane (not necessarily the same as the text color). If the EditField is disabled, the box draws with a gray pattern. The 1 pixel rectangle between the box and the text draws in the background color of the text.
Purpose:
Draw an EditField. This is an override of DrawSelf() in LPane.
Purpose:
Enable an EditField. This is an override of EnableSelf() in LPane.
Purpose:
Pass back the status of a Command. This is an override of FindCommandStatus() in LCommander.
Purpose:
Prepare for drawing in the EditField. This is an override of FocusDraw() in LPane.
Purpose:
Return the first 255 characters of the EditField as a Pascal string. The caller must allocate a Str255 variable for storing the string. This is an override of GetDescriptor() in LPane.
Purpose:
This method returns the handle to the Mac OS TextEdit structure.
Access:
Prototype:
TEHandle GetMacTEH();Parameters:
Return:
A handle to the TextEdit structure.
Purpose:
Return the integer value represented by the contents of an EditField. An empty or non-numerical EditField evaluates to zero. This is an override of GetValue() in LPane.
Purpose:
Handle key stroke directed at an EditField. Return true if the EditField handles the keystroke. This is an override of HandleKeyPress() in LCommander.
Purpose:
Hide an EditField. An invisible EditField can't be on duty. This is an override of HideSelf() in LPane.
Purpose:
Initialize member variables of a EditField to default values.
Access:
Prototype:
void InitEditField( UInt8 inAttributes );Parameters:
The parameter for this method is:
Return:
Purpose:
Move the location of the Frame by the specified amounts. This is an override of MoveBy() in LPane.
Purpose:
Handle standard editing commands. This is an override of ObeyCommand() in LCommander.
Purpose:
Change the Frame size by the specified amounts inWidthDelta and inHeightDelta specify, in pixels, how much larger to make the Frame. Positive
deltas increase the size, negative deltas reduce the size. This
is an override of ResizeFrameBy() in LPane.
Purpose:
Save TextEdit rectangles. This is an override of RestorePlace() in LPane.
Purpose:
Save TextEdit rectangles. This is an override of SavePlace() in LPane.
Purpose:
Select entire contents of an EditField.
Access:
Prototype:
virtual void SelectAll();Parameters:
Return:
Purpose:
Set the contents of an EditField from a Pascal string. This is an override of SetDescriptor() in LPane.
Purpose:
Specify the function for filtering keystrokes.
Access:
Prototype:
virtual void SetKeyFilter(Parameters:
KeyFilterFunc inKeyFilter );
The parameter for this method is:
Return:
Purpose:
Specify the maximum number of characters that an EditField can contain.
Access:
Prototype:
virtual void SetMaxChars( SInt16 inMaxChars );Parameters:
The parameter for this method is:
Return:
Purpose:
Specify the resource ID of the TextTraits for an EditField. This function updates the line height to fit the text characteristics.
Access:
Prototype:
virtual void SetTextTraitsID(ResIDT inTextTraitsID);Parameters:
The parameter for this method is:
Return:
Purpose:
Set the contents of an EditField to the string representation of aspecified integer number. This is an override of SetValue() in LPane.
Purpose:
At idle time, flash the insertion cursor. This is an override of SpendTime() in LPeriodical.
Purpose:
Indicate whether adding the specified number of characters will exceed the maximum allowed. This method assumes that the characters being added will replace the current selection.
Access:
Prototype:
virtual Boolean TooManyCharacters(Parameters:
SInt32 inCharsToAdd );
The parameter for this method is:
Return:
Returns true if the maximum will be exceeded, else false.
Purpose:
Specify whether the EditField word wraps to its frame.
Access:
Prototype:
virtual void UseWordWrap( Boolean inSetting );Parameters:
The parameter for this method is:
Return:
Purpose:
Text of EditField has changed as a result of the user actions. You should override this to validate the field and/or dynamically update the field as the user types. This function is not called by SetDescriptor(), which is typically used to programatically change the text.
Access:
Prototype:
virtual void UserChangedText();Parameters:
Return:
Purpose:
The handle to the TextEdit record.
Access:
Prototype:
TEHandle mTextEditH;
Purpose:
The key filter proc storage space.
Access:
Prototype:
KeyFilterFunc mKeyFilter;
Purpose:
Pointer to an LTETypingAction object.
Access:
Prototype:
LTETypingAction *mTypingAction;
Purpose:
The maximum number of characters that the field can accomodate.
Access:
Prototype:
SInt16 mMaxChars;
Purpose:
The resource ID for the text traits.
Access:
Prototype:
ResIDT mTextTraitsID;
Purpose:
Indicates whether the editAttr_Box enum attribute is set.
Access:
Prototype:
Boolean mHasBox;
Purpose:
Indicates whether the editAttr_WordWrap enum attribute is set.
Access:
Prototype:
Boolean mHasWordWrap;