class PEditBox: public PControl

This class defines a text edit box control.

Inheritance:


Public Methods

[more] PEditBox ( PInteractor * parent )
Create a new single line edit box control.
[more] PEditBox ( PInteractorLayout * parent, PRESOURCE_ID ctlID, const PNotifier & notify, PString * valuePtr )
Create control from interactor layout with the specified control ID.
[more]virtual ~PEditBox ()
Destroy the edit box control.
[more]virtual BOOL OnEndInput ()
The system calls this whenever the system wishes to change focus to another interactor in a given PTitledWindow or PInteractorLayout.
[more]virtual void TransferValue ( int option )
This function transfers the value of the control to or from the variable pointed to by the value pointer member variable.
[more]virtual void SetText ( const PString & str )
Set the text contents of the edit box control.
[more]PString GetText () const
Get the current text contents of the edit box control as entered by the user, or set via the SetText() function.
[more]PString* GetValuePointer () const
Get the current value pointer associated with the control.
[more]void SetValuePointer ( PString * ptr )
Set the current value pointer associated with the control.
[more]void SetMaxText ( PINDEX max )
Set the maximum amount of text that the user may enter in the combo-box edit text part.
[more]PINDEX GetLength () const
Get the current length of the text entered into the edit box.
[more]BOOL IsModified () const
Determine if the edit control has been modified by the user since the last call to SetText() or GetText().
[more]void SetSelection ( PINDEX start = 0, PINDEX finish = P_MAX_INDEX )
Set the selected region in the text within the edit box.
[more]BOOL GetSelection ( PINDEX * start = NULL, PINDEX * finish = NULL ) const
Get the selected region in the text in the edit box.
[more]void ReplaceSelection ( const PString & text, BOOL canUndo = TRUE )
Replace the selection with the string.
[more]BOOL CanUndo () const
Determine if the edit control can undo the last edit operation performed by the user.
[more]void Undo ()
Undo the last edit operation performed by the user.
[more]void Cut ()
Cut the selected text to the clipboard.
[more]void Copy () const
Copy the selected text to the clipboard.
[more]void Paste ()
Paste into the edit control from the clipboard into the edit box at the current caret position.
[more]void Clear ()
Delete the selected text.

Public

[more] PNotifier codes
[more] Notification codes sent to the callback function.
[more] Overrides from class PInteractor
[more] Overrides from class PControl
[more] New functions for class


Inherited from PControl:

Public Fields

oPRESOURCE_ID controlID

Public Methods

ovirtual PBalloon* OnBalloonHelp()
ovirtual BOOL IsTabStop() const
oPRESOURCE_ID GetControlID() const
ovoid SetControlID( PRESOURCE_ID theID )
oconst PNotifier& GetNotifier() const
oBOOL WillNotifyOnStateUpdate() const
ovoid SetNotifier( const PNotifier & func, BOOL notifyForStateUpdate = FALSE )
oconst PString& GetBalloonHelp() const
ovoid SetBalloonHelp( const PString & text )
ovirtual void DefaultDimensions()
ovirtual void UpdateMyCommandSources()

Public

o Codes passed to the notification function on changes of state.

Protected Fields

oPNotifier callback
ovoid* valuePointer
oBOOL notifyForStateUpdate
oPString balloonHelpText

Protected

Member variables


Inherited from PInteractor:

Public Classes

oenum PositionOrigin
oenum CoordinateSystem
oenum AutoAdjustType

Public Fields

oPCursor cursor

Public Methods

ovirtual Comparison Compare( const PObject & obj ) const
oPInteractor* GetParent() const
oBOOL IsChild( PInteractor * parent ) const
oPINDEX GetNumChildren()
oPInteractor& operator[]( PINDEX index )
ovirtual void UpdateCommandSources()
ovirtual void SetFont( const PFont & newFont, BOOL toChildren = TRUE )
oconst PRealFont& GetFont()
oPDIMENSION ToPixelsDX( PDIMENSION x ) const
oPDIMENSION ToPixelsDY( PDIMENSION y ) const
oPORDINATE ToPixelsX( PORDINATE x ) const
oPORDINATE ToPixelsY( PORDINATE y ) const
oPDim ToPixels( const PDim & dim ) const
oPPoint ToPixels( const PPoint & pt ) const
oPRect ToPixels( const PRect & r ) const
oPDIMENSION FromPixelsDX( PDIMENSION x ) const
oPDIMENSION FromPixelsDY( PDIMENSION y ) const
oPORDINATE FromPixelsX( PORDINATE x ) const
oPORDINATE FromPixelsY( PORDINATE y ) const
oPDim FromPixels( const PDim & dim ) const
oPPoint FromPixels( const PPoint & pt ) const
oPRect FromPixels( const PRect & r ) const
ovoid SetPosition( PORDINATE x, PORDINATE y, PositionOrigin xOrigin = TopLeftParent, PositionOrigin yOrigin = TopLeftParent )
oPPoint GetPosition( CoordinateSystem coords ) const
oPPoint ToScreen( PORDINATE x, PORDINATE y, CoordinateSystem coords ) const
oPPoint FromScreen( PORDINATE x, PORDINATE y, CoordinateSystem coords ) const
ovoid SetDimensions( PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
oPDim GetDimensions( CoordinateSystem coords ) const
oPRect GetStructureBounds( CoordinateSystem coords ) const
ovirtual PRect GetDrawingBounds( CoordinateSystem coords ) const
ovoid AutoAdjustBounds( PRect & bounds, AutoAdjustType type = AdjustBounds )
oBOOL ContainsPoint( const PPoint & pt, CoordinateSystem coords ) const
oPInteractor* FindInteractor( const PPoint & pt, CoordinateSystem coords ) const
ovirtual void Enable( BOOL enabled = TRUE )
ovoid Disable()
oBOOL IsEnabled() const
ovirtual void ShowAll()
ovirtual void Show( BOOL visible = TRUE )
ovoid Hide()
oBOOL IsVisible() const
ovirtual void BringToTop()
ovirtual BOOL IsOnTop() const
ovoid Invalidate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovoid Validate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovoid Update()
ovoid GrabMouse()
ovoid ReleaseMouse()
oBOOL HasMouse() const
ovoid GrabFocus()
oBOOL HasFocus() const
ovirtual void SetCursor( const PCursor & newCursor )
oPCursor GetCursor() const
ovoid SetCursorToParent( BOOL useParent = TRUE )
ovoid SetAllCursors( const PCursor & newCursor )
ovoid RestoreAllCursors()
ovoid SetWaitCursor()
ovoid SetCursorPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
oPPoint GetCursorPos( CoordinateSystem coords ) const
ovirtual void ShowCursor( BOOL show = TRUE )
ovoid HideCursor()
ovoid SetCaret( const PCaret & newCaret )
oPCaret GetCaret() const
ovoid SetCaretPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
oPPoint GetCaretPos( CoordinateSystem coords ) const
ovirtual void ShowCaret(BOOL show = TRUE)
ovoid HideCaret()
ovirtual void SetForegroundColour( const PColour & newColour )
oconst PColour& GetForegroundColour() const
ovirtual void SetBackgroundColour( const PColour & newColour )
oconst PColour& GetBackgroundColour() const
oPDim GetBorderSize() const
oconst PColour& GetBorderColour() const
oPCanvas* StartMouseTrack( BOOL wantsCanvas = FALSE )
ovirtual void OnMouseMove( PKeyCode button, const PPoint & where )
ovirtual void OnMouseDown( PKeyCode button, const PPoint & where, BOOL doubleClick )
ovirtual void OnMouseUp( PKeyCode button, const PPoint & where )
ovirtual BOOL OnKeyDown( PKeyCode key, unsigned repeat )
ovirtual void OnKeyUp( PKeyCode key )
ovirtual void OnKeyInput( const PString & str )
ovirtual void OnGainFocus()
ovirtual void OnLostFocus()
ovirtual void OnStartInput()
ovirtual void OnRedraw( PCanvas & canvas )
ovirtual void OnControlNotify( PControl & control, int option )
ovirtual void OnSelectHelp()
ovirtual void OnMouseTrack( PCanvas * canvas, const PPoint & where, BOOL lastTrack )
ovirtual void _SetPosition( PORDINATE x, PORDINATE y, PositionOrigin xOrigin, PositionOrigin yOrigin )

Public

Overrides from class PObject

System callback functions.

Protected Fields

oPApplication* owner
oPInteractor* parent
oPInteractorList children
oPRealFont font
oPCursor savedCursor
oPCaret caret
oPPoint caretPosition
oint caretVisible
oPColour foregroundColour
oPColour backgroundColour
oPInteractor* mouseTrackInteractor
oPInteractorCanvas* mouseTrackCanvas

Protected Methods

ovirtual void _SetDimensions( PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovirtual void _Invalidate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovirtual void _Validate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovirtual void _SetCursorPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
ovirtual void _SetCaretPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
ovirtual void SetFocusInteractor( PInteractor * interactor )
ovirtual PInteractor* GetFocusInteractor() const

Protected

o Flag to indicate that the parent interactor layouts cursor should be used with this interactor.


Documentation

This class defines a text edit box control. This control is for a single line of text. The usual capabilities for editing text are available, though the exact features are platform dependent.
o PEditBox( PInteractor * parent )
Create a new single line edit box control.
Parameters:
parent - Interactor into which the control is placed.

o PEditBox( PInteractorLayout * parent, PRESOURCE_ID ctlID, const PNotifier & notify, PString * valuePtr )
Create control from interactor layout with the specified control ID.
Parameters:
parent - Interactor into which the box is placed.
ctlID - Identifier for the control in the layout.
notify - Function to call when changes state.
valuePtr - Variable to change to the editor value.

ovirtual ~PEditBox()
Destroy the edit box control.

o PNotifier codes

o Notification codes sent to the callback function.
Notification codes sent to the callback function.

o EditChange
Notification code for each change of the edit text box string. This would notify the user on every key entered and may be used to take action on the particular value of the control.

o EndEdit
Notification code for when the user exits the edit box. This occurs when the control loses the keyboard focus and the OnEndInput() function has returned TRUE.

o Overrides from class PInteractor

ovirtual BOOL OnEndInput()
The system calls this whenever the system wishes to change focus to another interactor in a given PTitledWindow or PInteractorLayout.

This function in conjunction with the keyboard focus changing and the PInteractor::SetFocusInteractor() function controls the transfer of focus from one interactor in a logical group (eg dialog) to another. It is primarily used for field level validation. For example the PIntegerEditBox control uses this to prevent the user from exiting the control until a valid entry hash been made.

Note that the focus does actually change with appropriate calls to the PInteractor::OnGainFocus() and PInteractor::OnLostFocus() functions. The focus gets set back to the original interactor when this function disallows the focus change.

For edit boxes this will execute the notification function before returning TRUE.

Returns:
FALSE will prevent the focus change from occurring and TRUE allows the change.

o Overrides from class PControl

ovirtual void TransferValue( int option )
This function transfers the value of the control to or from the variable pointed to by the value pointer member variable.
Parameters:
option - Transfer value option. When this is -1 when the function transfers the value from the value pointer into the control. This is called in PDialog::OnInit() function. When option is zero then the function transfers the value from the control to the value pointer variable. This is called just before the callback function every time the edit box value changes.

o New functions for class

ovirtual void SetText( const PString & str )
Set the text contents of the edit box control. This will be updated on the screen immediately (within OS constraints).

A call to this function will cause the notification function to be called with a code of EditChange.

Parameters:
str - New value string for the edit text box.

oPString GetText() const
Get the current text contents of the edit box control as entered by the user, or set via the SetText() function.

Returns:
string for the current contents of the edit box.

oPString* GetValuePointer() const
Get the current value pointer associated with the control. The variable pointed to by this is autamatically updated with the current value of the edit box.

Returns:
value pointer associated with the control.

ovoid SetValuePointer( PString * ptr )
Set the current value pointer associated with the control. The variable pointed to by this is autamatically updated with the current value of the edit box.
Parameters:
ptr - New value pointer to associate with the control.

ovoid SetMaxText( PINDEX max )
Set the maximum amount of text that the user may enter in the combo-box edit text part. Extra characters entered when it is full are ignored.
Parameters:
max - New maximum character entry limit.

oPINDEX GetLength() const
Get the current length of the text entered into the edit box. This is equivalent to GetText().GetLength().

Returns:
number of characters in edit box.

oBOOL IsModified() const
Determine if the edit control has been modified by the user since the last call to SetText() or GetText().

Returns:
TRUE if the user has changed the text in the edit box.

ovoid SetSelection( PINDEX start = 0, PINDEX finish = P_MAX_INDEX )
Set the selected region in the text within the edit box. The selected region includes the character at the start position but does not include the character at the finish position.

If start and finish are equal then there is no selected region. However, the caret is placed immediately before that position, ie so that the next character entered will be at start offset into the resultant string.

If finish is less than start it is set to the same value as start. If either value is greater than the current length of the edit box, then they are set to the position of the end of the string.

Parameters:
start - Start index position of selected text.
finish - Finish index position of selected text.

oBOOL GetSelection( PINDEX * start = NULL, PINDEX * finish = NULL ) const
Get the selected region in the text in the edit box. If there is no selection active, the start and finish variables are both set to the caret position in the string.

Returns:
TRUE if has selection, FALSE if there is nothing selected.
Parameters:
start - Pointer to receive starting position of selected text.
finish - Pointer to receive finishing position of selected text.

ovoid ReplaceSelection( const PString & text, BOOL canUndo = TRUE )
Replace the selection with the string. If there is no selection then the string is inserted into the edit box at the curent cursor location.
Parameters:
text - Text to replace selection with
canUndo - Flag to indicate replacement can be undone.

oBOOL CanUndo() const
Determine if the edit control can undo the last edit operation performed by the user.

Returns:
TRUE if undo will succeed.

ovoid Undo()
Undo the last edit operation performed by the user.

ovoid Cut()
Cut the selected text to the clipboard. This copies the data and then deletes the current selection.

If there is no current selection then this function does nothing.

A call to this function will cause the notification functionto be called with a code of EditChange.

ovoid Copy() const
Copy the selected text to the clipboard.

If there is no current selection then this function does nothing.

ovoid Paste()
Paste into the edit control from the clipboard into the edit box at the current caret position.

If the paste would add so many characters that the limit set with SetMaxText() would be exceeded then the paste does not take place.

Also, if there is no text in the clipboard then this function does nothing.

A call to this function will cause the notification functionto be called with a code of EditChange.

ovoid Clear()
Delete the selected text. This does not copy the information to the clipboard and the selected text is lost.

If there is no current selection then this function does nothing.

A call to this function will cause the notification functionto be called with a code of EditChange.


Direct child classes:
PPasswordEditBox
PNumberEditBox
PMultiLineEditBox

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.