home *** CD-ROM | disk | FTP | other *** search
- //************************************************************************
- //
- // Copyright 1987-1992 Data Access Corporation, Miami FL, USA
- // All Rights reserved
- // DataFlex is a registered trademark of Data Access Corporation.
- //
- //
- // $Source: /u3/source.30/product/pkg/RCS/entitem.pkg,v $
- // $Revision: 1.1 $
- // $State: Exp $
- // $Author: james $
- // $Date: 1992/09/08 14:43:04 $
- // $Locker: $
- //
- // $Log: entitem.pkg,v $
- //Revision 1.1 1992/09/08 14:43:04 james
- //Initial revision
- //
- //Revision 1.4 92/06/17 23:57:36 lee
- //added object_item_entry_exit property to disable item entry/exit messages
- //during scroll.
- //
- //Revision 1.3 92/05/14 16:45:57 SWM
- //Updated Copyright slug.
- //
- //Revision 1.2 92/03/09 19:01:29 james
- //Added #CHKSUB directive to insure source
- //only compiled with correct revision of
- //compiler.
- //
- //Revision 1.1 91/10/23 10:20:28 elsa
- //Initial revision
- //
- //************************************************************************/
-
- //************************************************************************
- // File Name: EntItem.Inc
- // Creation Date: January 1, 1991
- // Modified Date: May 23, 1991
- // Author(s): Steven A. Lowe
- //
- // This module defines the routines and properties required to support
- // the use of entry-items, collected in the abstract class Entry_Item_Mixin.
- //
- // This file should be USEd prior to and IMPORTed within the scope of the
- // class definition by any user-interface (esp. data-entry) class which
- // must support entry-items.
- //
- // This file is used by ENTRYFRM.PKG and WIDELIST.PKG.
- //************************************************************************/
-
- #CHKSUB 1 1 // Verify the UI subsystem.
-
- use ui
-
- class Entry_Item_Mixin is a message
-
- //
- // Description
- //
- // This procedure defines kPrompt and kZoom accelerator keys for this
- // object.
- //
- // Assumptions/Preconditions
- //
- // This procedure should only be invoked from the Construct_Object
- // procedure of a class definition.
- //
- // Exceptions
- //
- // None.
- //
- // Notes
- //
- // None.
- //
- procedure define_entry_item
- on_key kPrompt SEND Prompt PRIVATE
- on_key kZoom SEND Zoom PRIVATE
- property integer object_item_entry_exit PUBLIC TRUE
- end_procedure
-
-
- //
- // Description
- //
- // This procedure activates the zoom-objct, if any, for the current
- // entry-item.
- //
- // Assumptions/Preconditions
- //
- // This object (or one of its ancestor classes) implements a
- // zoom_object function to return a valid object id (for a
- // user-interface object understanding the PopUp message), or 0.
- //
- // Exceptions
- //
- // If the zoom-object is 0, no action is taken.
- //
- // Notes
- //
- // None.
- //
- procedure Zoom
- local integer obj#
- get zoom_object item CURRENT to obj#
- if obj# ne 0 send POPUP to obj#
- end_procedure
-
-
- //
- // Description
- //
- // This procedure activates the prompt-objct, if any, for the current
- // entry-item.
- //
- // Assumptions/Preconditions
- //
- // This object (or one of its ancestor classes) implements a
- // prompt_object function to return a valid object id (for a
- // user-interface object understanding the PopUp message), or 0.
- //
- // Exceptions
- //
- // If the prompt-object is 0, no action is taken.
- //
- // Notes
- //
- // None.
- //
- procedure Prompt
- local integer obj#
- get prompt_object item CURRENT to obj#
- if obj# ne 0 send POPUP to obj#
- end_procedure
-
-
- //
- // Description
- //
- // This function invokes the message given by msg#, passing the
- // specified item# as the only argument to the message. The value
- // returned by execution of the message is returned; non-zero means
- // that entry to the specified item# should be denied.
- //
- // Assumptions/Preconditions
- //
- // The msg# argument must be either a valid message id or 0. The item#
- // argument must be a valid entry-item index (between 0 and Item_Count-1).
- //
- // Exceptions
- //
- // If the specified msg# is 0, no action is taken.
- //
- // Notes
- //
- // This function is invoked by the Item_Change procedure, among others.
- //
- function ITEM_ENTRY integer msg# integer item# returns integer
- local integer retVal
- if not (object_item_entry_exit(current_object)) function_return 0
- move 0 to retval
- if msg# ne 0 get msg# item item# to retVal
- function_return retVal
- end_function
-
-
- //
- // Description
- //
- // This function invokes the message given by msg#, passing the
- // specified item# as the only argument to the message. The value
- // returned by execution of the message is returned; non-zero means
- // that exit from the specified item# should be denied.
- //
- // Assumptions/Preconditions
- //
- // The msg# argument must be either a valid message id or 0. The item#
- // argument must be a valid entry-item index (between 0 and Item_Count-1).
- //
- // Exceptions
- //
- // If the specified msg# is 0, no action is taken.
- //
- // Notes
- //
- // This function is invoked by the Item_Change procedure, among others.
- //
- function ITEM_EXIT integer msg# integer item# returns integer
- local integer retVal
- if not (object_item_entry_exit(current_object)) function_return 0
- move 0 to retval
- if msg# ne 0 get msg# item item# to retVal
- function_return retVal
- end_function
-
-
- //
- // Description
- //
- // This function invokes the message given by msg#, passing the
- // specified item# as the only argument to the message. The value
- // returned by execution of the message is returned; non-zero means
- // that the data entered in the specified item# is invalid, and that
- // the cursor should stay on the specified item#.
- //
- // Assumptions/Preconditions
- //
- // The msg# argument must be either a valid message id or 0. The item#
- // argument must be a valid entry-item index (between 0 and Item_Count-1).
- //
- // Exceptions
- //
- // If the specified msg# is 0, no action is taken.
- //
- // Notes
- //
- // This function is invoked by the Item_Change procedure, among others.
- //
- function ITEM_VALIDATE integer msg# integer item# returns integer
- local integer retVal
- move 0 to retval
- if msg# ne 0 get msg# item item# to retVal
- function_return retVal
- end_function
-
-
- //
- // Description
- //
- // This function invokes the entry-message for the specified item#, and
- // returns the result; non-zero means that entry to the specified item#
- // should be denied.
- //
- // Assumptions/Preconditions
- //
- // The item# argument must be a valid entry-item index (between 0 and
- // Item_Count-1), or the sentinel value CURRENT.
- //
- // Exceptions
- //
- // None.
- //
- // Notes
- //
- // This function is used to force execution of an item's entry-msg.
- //
- function exec_entry integer item# returns integer
- local integer retval curItem entMsg
- if item# eq CURRENT get current_item to curItem
- else move item# to curItem
- get item_entry_msg item curItem to entMsg
- get item_entry entMsg curItem to retval
- function_return retval
- end_function
-
-
- //
- // Description
- //
- // This function invokes the exit-message for the specified item#, and
- // returns the result; non-zero means that exit from the specified item#
- // should be denied.
- //
- // Assumptions/Preconditions
- //
- // The item# argument must be a valid entry-item index (between 0 and
- // Item_Count-1), or the sentinel value CURRENT.
- //
- // Exceptions
- //
- // None.
- //
- // Notes
- //
- // This function is used to force execution of an item's exit-msg.
- //
- function exec_exit integer item# returns integer
- local integer retval curItem exitMsg
- if item# eq CURRENT get current_item to curItem
- else move item# to curItem
- get item_exit_msg item curItem to exitMsg
- get item_exit exitMsg curItem to retval
- function_return retval
- end_function
-
-
- //
- // Description
- //
- // This function invokes the validate-message for the specified item#,
- // and returns the result; non-zero means that the data entered in the
- // specified item# is invalid, and that the cursor should stay on the
- // specified item#.
- //
- // Assumptions/Preconditions
- //
- // The item# argument must be a valid entry-item index (between 0 and
- // Item_Count-1), or the sentinel value CURRENT.
- //
- // Exceptions
- //
- // If the specified item# uses the AUTOFIND option, an entry_autofind
- // is performed.
- //
- // Notes
- //
- // This function is used to force execution of an item's validate-msg.
- //
- function exec_validate integer item# returns integer
- local integer retval curItem valMsg chgd autoFlag autoGEFlag
- if item# eq CURRENT get current_item to curItem
- else move item# to curItem
- //
- // check for AUTOFIND, AUTOFIND_GE
- //
- #IFSUB 'AUTOFIND_BIT'
- #ELSE
- #REPLACE AUTOFIND_BIT 0
- #ENDIF
- #IFSUB 'AUTOFIND_GE_BIT'
- #ELSE
- #REPLACE AUTOFIND_GE_BIT 8
- #ENDIF
- get item_changed_State item curItem to chgd
- if chgd ne 0 begin
- get item_option item curItem AUTOFIND_BIT retval
- if retval begin
- get item_option item curItem AUTOFIND_GE_BIT retval
- if retval send entry_autofind GE
- else send entry_autofind EQ
- end
- end
- //
- // validate item
- //
- get Valid_Item item curItem to retval
- function_return retval
- end_function
- end_class
-