home *** CD-ROM | disk | FTP | other *** search
- Notes on the predefined Get object class.
-
- Note: this information supersedes the information in the
- pre-release documentation.
-
-
- o Get Objects
-
- Note: for a general discussion of Clipper 5.0 predefined
- objects, refer to the "Basic Concepts" chapter of the
- documentation.
-
- A Get object is a general purpose mechanism for editing data.
- It is used in Clipper 5.0 to implement the @...GET and READ
- commands. Get objects provide a sophisticated architecture for
- formatting and editing data, including cursor navigation and
- data validation. Data validation is performed via
- user-supplied code blocks, and display formatting can be
- controlled using standard picture strings.
-
- Normally, a Get object is associated with a particular variable
- (referred to below as the "Get variable"). The Get object does
- not directly access this variable; instead, the variable is
- manipulated by evaluating a supplied code block. When a Get
- object is created using the standard @..GET commands, a code
- block is automatically created which provides access to the
- variable named in the command. For Gets created with the
- GetNew() function, an appropriate code block must be supplied.
-
- A Get evaluates the supplied code block to retrieve the value
- of the Get variable. The value is converted to displayable
- form and copied into a buffer (the "editing buffer") that is
- displayed on the screen for editing. Programmable behaviors
- allow the navigation of the editing buffer and subsequent
- copying of its contents back to the Get variable.
-
-
- o Exported Instance Variables
-
- badDate
-
- Contains a logical value. The value is true (.T.) if the Get
- is a date type and the date represented by the contents of the
- editing buffer is invalid. If the date is valid or if the Get
- is not editing a date value, badDate is false (.F.).
-
-
- block (Assignable)
-
- Contains a code block that is used to associate the Get object
- with a variable. The block must take an optional parameter.
- When the parameter is supplied, the block must assign the
- parameter value to the variable. Otherwise, the current value
- of the variable is returned.
-
-
- buffer (Assignable)
-
- Contains a character value that defines the editing buffer used
- by the Get object. This variable is meaningful only while the
- Get object has input focus. At other times, its value is NIL
- and attempts to assign a new value are ignored.
-
-
- cargo (Assignable)
-
- Contains a value of any data type. This instance variable is
- unused by the Get object. It is provided as a user-definable
- slot, allowing arbitrary information to attached to a Get
- object and retrieved later.
-
-
- col (Assignable)
-
- Contains a numeric value that defines the screen column where
- the Get will be displayed.
-
-
- colorSpec (Assignable)
-
- Contains a character string that defines the display attributes
- for the Get object. The string must contain two color
- specifiers. The first, called the unselected color, determines
- the color of the Get object when it does not have input focus.
- The second, called the selected color, determines the color of
- the Get when it does have input focus.
-
- If no colors are specified for a Get, the colors are
- initialized using the current SETCOLOR() colors. The
- SETCOLOR() unselected and enhanced colors are used as the Get
- object's unselected and selected colors, respectively. See
- SETCOLOR() in the Standard Functions chapter of this book for
- more information on color specifiers.
-
-
- decPos
-
- Contains a numeric value that indicates the decimal point
- position within the editing buffer. This variable is
- meaningful only when the value being edited is numeric and the
- Get has input focus. At other times, its value is NIL.
-
-
- hasFocus
-
- A logical value. The value is true (.T.) if the Get object has
- input focus; otherwise false (.F.).
-
-
- name (Assignable)
-
- Contains an optional character string representing the name of
- the Get variable. For Get objects created using the standard
- @..GET commands, the name is present.
-
- The Get object itself ignores this variable; it is used by the
- standard READ command to implement the READVAR() function (see
- READVAR() in the Standard Functions chapter of this book).
-
-
- original
-
- Contains a value of any data type. This instance variable
- contains a copy of the value that was in the Get variable at
- the time the Get object acquired input focus. This copy is
- used to implement the undo message. The value is meaningful
- only while the Get has input focus. At other times, its value
- is NIL.
-
-
- picture (Assignable)
-
- Contains a character value that defines the PICTURE string used
- to control formatting and editing for the Get object. See the
- @...GET entry in the Standard Commands chapter for more
- information on PICTURE strings.
-
-
- pos
-
- Contains a numeric value indicating the position of the cursor
- within the editing buffer. This variable is meaningful only
- while the Get object has input focus. At other times, its
- value is NIL.
-
-
- postBlock (Assignable)
-
- Contains an optional code block that can be used to validate a
- newly entered value. If present, the postBlock should contain
- an expression that evaluates to true (.T.) for a legal value;
- otherwise false (.F.). For Get objects created with the
- standard @..GET..VALID command, postBlock is present and
- contains the expression specified in the VALID clause.
-
- The Get object itself ignores this variable; it is used by the
- standard READ command to implement the VALID clause. In the
- standard READ command, a parameter is supplied to the postBlock
- when it is evaluated: the value of the Get variable after any
- editing. The parameter allows the postBlock to validate the
- value without directly referring to the Get variable.
-
-
- preBlock (Assignable)
-
- Contains an optional code block that can be used to decide
- whether or not editing should be permitted. If present, the
- preBlock should evaluate to true (.T.) if editing is to be
- permitted; otherwise false (.F.). For Get objects created with
- the standard @..GET..WHEN command, preBlock is present and
- contains the expression specified in the WHEN clause.
-
- The Get object itself ignores this variable; it is used by the
- standard READ command to implement the WHEN clause.
-
-
- rejected
-
- Contains a logical value. The value is true (.T.) if the last
- insert or overStrike message specified a character that was
- rejected (not placed in the editing buffer). Note that any
- subsequent text entry message will reset this variable.
-
-
- row (Assignable)
-
- Contains a numeric value that defines the screen row where the
- Get will display.
-
-
- type
-
- Contains a single letter representing the data type of the Get
- variable. For information on type-letters, refer to VALTYPE()
- in the Standard Functions chapter of this book.
-
-
- typeOut
-
- Contains a logical value. The value is true (.T.) if the most
- recent message attempted to move the cursor out of the editing
- buffer (or if there are no editable positions in the buffer).
- Note that this variable is reset by any message which moves the
- cursor.
-
-
-
- o State Change Methods
-
- assign() <-- self
-
- Assigns the value in the editing buffer to the Get variable by
- evaluating the associated code block with the new value as a
- parameter. This message is meaningful only while the Get has
- input focus.
-
-
- display() <-- self
-
- Displays the Get on the screen. If the Get has input focus, it
- is displayed in its selected color and the hardware cursor is
- placed at the screen location corresponding to the current
- editing position within the editing buffer. If the Get does
- not have input focus, it is displayed in its unselected color
- with no cursor.
-
-
- killFocus() <-- self
-
- Takes input focus away from the Get object. Upon receiving
- this message, the Get object redisplays its editing buffer and
- discards its internal state information.
-
-
- reset() <-- self
-
- Resets the Get object's internal state information. This
- includes resetting the editing buffer to reflect the current
- value of the Get variable, and setting the cursor position to
- the first editable position within the buffer. This message
- has meaning only while the Get object has input focus.
-
-
- setFocus() <-- self
-
- Gives input focus to the Get object. Upon receiving this
- message, the Get object creates and initializes its internal
- state information, including the exported instance variables
- buffer, pos, decPos, and original. The contents of the editing
- buffer are then displayed in the Get's selected color.
-
-
- undo() <-- self
-
- Sets the Get variable back to the value it had when the Get
- acquired input focus. This message has meaning only while the
- GET has input focus.
-
- The effect of the undo message is equivalent to assigning the
- Get variable from the saved value in the "original" instance
- variable, and then sending the reset message.
-
-
- updateBuffer() <-- self
-
- Sets the editing buffer to reflect the current value of the Get
- variable, and redisplays the Get. This message has meaning
- only while the Get has input focus.
-
-
-
- o Cursor Movement Methods
-
- end() <-- self
-
- Moves the cursor to the rightmost editable position within the
- editing buffer.
-
-
- home() <-- self
-
- Moves the cursor to the leftmost editable position within the
- editing buffer.
-
-
- left() <-- self
-
- Moves the cursor left to the nearest editable position within
- the editing buffer. If there is no editable position to the
- left, the cursor position is left unchanged.
-
-
- right() <-- self
-
- Moves the cursor right to the nearest editable position within
- the editing buffer. If there is no editable position to the
- right, the cursor position is left unchanged.
-
-
- toDecPos() <-- self
-
- Moves the cursor to the immediate right of the decimal point
- position in the editing buffer. This message is only
- meaningful when editing numeric values.
-
-
- wordLeft() <-- self
-
- Moves the cursor one word to the left within the editing
- buffer. If the cursor is already at the leftmost editable
- position, it is left unchanged.
-
-
- wordRight() <-- self
-
- Moves the cursor one word to the right within the Get buffer.
- If the cursor is already at the rightmost editable position, it
- is left unchanged.
-
-
-
- o Editing Methods
-
- backspace() <-- self
-
- Deletes the character to the left of the cursor, and moves the
- cursor one position to the left. If the cursor is already at
- the leftmost editable position in the editing buffer, the
- message has no effect.
-
-
- delLeft() <-- self
-
- Deletes the character to the left of the cursor.
-
-
- delRight() <-- self
-
- Deletes the character to the right of the cursor.
-
-
- delWordLeft() <-- self
-
- Deletes the word to the left of the cursor.
-
-
- delWordRight() <-- self
-
- Deletes the word to the right of the cursor.
-
-
-
- o Text Entry Methods
-
- insert(<cChar>) <-- self
-
- Inserts <cChar> into the editing buffer at the current cursor
- position, shifting the existing contents of the buffer to the
- right. The cursor is placed one position to the right of the
- inserted string.
-
-
- overStrike(<cChar>) <-- self
-
- Puts <cChar> into the editing buffer at the current cursor
- position, overwriting the existing contents of the buffer. The
- cursor is placed one position to the right of the inserted
- string.
-
-
-
- o The GetNew() function
-
- The GetNew() function is used to create a new Get object. The
- syntax is show below:
-
- GetNew(<nRow>, <nCol>, <bBlock>, [<cPicture>], [<cColorSpec>])
-
- Returns a new Get object with the row, col, block, picture, and
- colorSpec instance variables set from the supplied arguments.
-
-
-
- o The ReadModal() function
-
- ReadModal() performs the standard Clipper 5.0 READ command. It
- takes a single parameter which is an array of Get objects:
-
- ReadModal(aGetList)
-
- The standard READ command is preprocessed into a call to
- ReadModal() with the current (or system) get list as the
- parameter. The source code for ReadModal() can be found in
- GETSYS.PRG in the SOURCE directory.
-
-
-
- o Examples
-
- Refer to the files GETSYS.PRG and TBDEMO.PRG in the SOURCE
- directory.
-