home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / dataflex / entitem.pkg < prev    next >
Encoding:
Text File  |  1993-08-10  |  9.6 KB  |  342 lines

  1. //************************************************************************
  2. //
  3. // Copyright 1987-1992 Data Access Corporation, Miami FL, USA
  4. // All Rights reserved
  5. // DataFlex is a registered trademark of Data Access Corporation.
  6. //
  7. //
  8. //     $Source: /u3/source.30/product/pkg/RCS/entitem.pkg,v $
  9. //     $Revision: 1.1 $
  10. //     $State: Exp $
  11. //     $Author: james $
  12. //     $Date: 1992/09/08 14:43:04 $
  13. //     $Locker:  $
  14. //
  15. //     $Log: entitem.pkg,v $
  16. //Revision 1.1  1992/09/08  14:43:04  james
  17. //Initial revision
  18. //
  19. //Revision 1.4  92/06/17  23:57:36  lee
  20. //added object_item_entry_exit property to disable item entry/exit messages
  21. //during scroll.
  22. //
  23. //Revision 1.3  92/05/14  16:45:57  SWM
  24. //Updated Copyright slug.
  25. //
  26. //Revision 1.2  92/03/09  19:01:29  james
  27. //Added #CHKSUB directive to insure source
  28. //only compiled with correct revision of 
  29. //compiler.
  30. //
  31. //Revision 1.1  91/10/23  10:20:28  elsa
  32. //Initial revision
  33. //
  34. //************************************************************************/
  35.  
  36. //************************************************************************
  37. //     File Name: EntItem.Inc
  38. // Creation Date: January 1, 1991
  39. // Modified Date: May 23, 1991
  40. //     Author(s): Steven A. Lowe
  41. //
  42. // This module defines the routines and properties required to support
  43. // the use of entry-items, collected in the abstract class Entry_Item_Mixin.
  44. //
  45. // This file should be USEd prior to and IMPORTed within the scope of the
  46. // class definition by any user-interface (esp. data-entry) class which
  47. // must support entry-items.
  48. //
  49. // This file is used by ENTRYFRM.PKG and WIDELIST.PKG.
  50. //************************************************************************/
  51.  
  52. #CHKSUB 1 1 // Verify the UI subsystem.
  53.  
  54. use ui
  55.  
  56. class Entry_Item_Mixin is a message
  57.  
  58.   //
  59.   // Description
  60.   //
  61.   //   This procedure defines kPrompt and kZoom accelerator keys for this
  62.   //   object.
  63.   //
  64.   // Assumptions/Preconditions
  65.   //
  66.   //   This procedure should only be invoked from the Construct_Object
  67.   //   procedure of a class definition.
  68.   //
  69.   // Exceptions
  70.   //
  71.   //   None.
  72.   //
  73.   // Notes
  74.   //
  75.   //   None.
  76.   //
  77.   procedure define_entry_item
  78.     on_key kPrompt SEND Prompt PRIVATE
  79.     on_key kZoom   SEND Zoom   PRIVATE
  80.     property integer object_item_entry_exit PUBLIC TRUE
  81.   end_procedure
  82.  
  83.  
  84.   //
  85.   // Description
  86.   //
  87.   //   This procedure activates the zoom-objct, if any, for the current
  88.   //   entry-item.
  89.   //
  90.   // Assumptions/Preconditions
  91.   //
  92.   //   This object (or one of its ancestor classes) implements a
  93.   //   zoom_object function to return a valid object id (for a
  94.   //   user-interface object understanding the PopUp message), or 0.
  95.   //
  96.   // Exceptions
  97.   //
  98.   //   If the zoom-object is 0, no action is taken.
  99.   //
  100.   // Notes
  101.   //
  102.   //   None.
  103.   //
  104.   procedure Zoom
  105.     local integer obj#
  106.     get zoom_object item CURRENT to obj#
  107.     if obj# ne 0 send POPUP to obj#
  108.   end_procedure
  109.  
  110.  
  111.   //
  112.   // Description
  113.   //
  114.   //   This procedure activates the prompt-objct, if any, for the current
  115.   //   entry-item.
  116.   //
  117.   // Assumptions/Preconditions
  118.   //
  119.   //   This object (or one of its ancestor classes) implements a
  120.   //   prompt_object function to return a valid object id (for a
  121.   //   user-interface object understanding the PopUp message), or 0.
  122.   //
  123.   // Exceptions
  124.   //
  125.   //   If the prompt-object is 0, no action is taken.
  126.   //
  127.   // Notes
  128.   //
  129.   //   None.
  130.   //
  131.   procedure Prompt
  132.     local integer obj#
  133.     get prompt_object item CURRENT to obj#
  134.     if obj# ne 0 send POPUP to obj#
  135.   end_procedure
  136.  
  137.  
  138.   //
  139.   // Description
  140.   //
  141.   //   This function invokes the message given by msg#, passing the
  142.   //   specified item# as the only argument to the message.  The value
  143.   //   returned by execution of the message is returned; non-zero means
  144.   //   that entry to the specified item# should be denied.
  145.   //
  146.   // Assumptions/Preconditions
  147.   //
  148.   //   The msg# argument must be either a valid message id or 0.  The item#
  149.   //   argument must be a valid entry-item index (between 0 and Item_Count-1).
  150.   //
  151.   // Exceptions
  152.   //
  153.   //   If the specified msg# is 0, no action is taken.
  154.   //
  155.   // Notes
  156.   //
  157.   //   This function is invoked by the Item_Change procedure, among others.
  158.   //
  159.   function ITEM_ENTRY integer msg# integer item# returns integer 
  160.     local integer retVal
  161.     if not (object_item_entry_exit(current_object)) function_return 0
  162.     move 0 to retval
  163.     if msg# ne 0 get msg# item item# to retVal
  164.     function_return retVal
  165.   end_function
  166.  
  167.  
  168.   //
  169.   // Description
  170.   //
  171.   //   This function invokes the message given by msg#, passing the
  172.   //   specified item# as the only argument to the message.  The value
  173.   //   returned by execution of the message is returned; non-zero means
  174.   //   that exit from the specified item# should be denied.
  175.   //
  176.   // Assumptions/Preconditions
  177.   //
  178.   //   The msg# argument must be either a valid message id or 0.  The item#
  179.   //   argument must be a valid entry-item index (between 0 and Item_Count-1).
  180.   //
  181.   // Exceptions
  182.   //
  183.   //   If the specified msg# is 0, no action is taken.
  184.   //
  185.   // Notes
  186.   //
  187.   //   This function is invoked by the Item_Change procedure, among others.
  188.   //
  189.   function ITEM_EXIT integer msg# integer item# returns integer 
  190.     local integer retVal
  191.     if not (object_item_entry_exit(current_object)) function_return 0
  192.     move 0 to retval
  193.     if msg# ne 0 get msg# item item# to retVal
  194.     function_return retVal
  195.   end_function
  196.  
  197.  
  198.   //
  199.   // Description
  200.   //
  201.   //   This function invokes the message given by msg#, passing the
  202.   //   specified item# as the only argument to the message.  The value
  203.   //   returned by execution of the message is returned; non-zero means
  204.   //   that the data entered in the specified item# is invalid, and that
  205.   //   the cursor should stay on the specified item#.
  206.   //
  207.   // Assumptions/Preconditions
  208.   //
  209.   //   The msg# argument must be either a valid message id or 0.  The item#
  210.   //   argument must be a valid entry-item index (between 0 and Item_Count-1).
  211.   //
  212.   // Exceptions
  213.   //
  214.   //   If the specified msg# is 0, no action is taken.
  215.   //
  216.   // Notes
  217.   //
  218.   //   This function is invoked by the Item_Change procedure, among others.
  219.   //
  220.   function ITEM_VALIDATE integer msg# integer item# returns integer 
  221.     local integer retVal
  222.     move 0 to retval
  223.     if msg# ne 0 get msg# item item# to retVal
  224.     function_return retVal
  225.   end_function
  226.  
  227.  
  228.   //
  229.   // Description
  230.   //
  231.   //   This function invokes the entry-message for the specified item#, and
  232.   //   returns the result; non-zero means that entry to the specified item#
  233.   //   should be denied.
  234.   //
  235.   // Assumptions/Preconditions
  236.   //
  237.   //   The item# argument must be a valid entry-item index (between 0 and
  238.   //   Item_Count-1), or the sentinel value CURRENT.
  239.   //
  240.   // Exceptions
  241.   //
  242.   //   None.
  243.   //
  244.   // Notes
  245.   //
  246.   //   This function is used to force execution of an item's entry-msg.
  247.   //
  248.   function exec_entry integer item# returns integer
  249.     local integer retval curItem entMsg
  250.     if item# eq CURRENT get current_item to curItem
  251.     else move item# to curItem
  252.     get item_entry_msg item curItem to entMsg
  253.     get item_entry entMsg curItem to retval
  254.     function_return retval
  255.   end_function
  256.  
  257.  
  258.   //
  259.   // Description
  260.   //
  261.   //   This function invokes the exit-message for the specified item#, and
  262.   //   returns the result; non-zero means that exit from the specified item#
  263.   //   should be denied.
  264.   //
  265.   // Assumptions/Preconditions
  266.   //
  267.   //   The item# argument must be a valid entry-item index (between 0 and
  268.   //   Item_Count-1), or the sentinel value CURRENT.
  269.   //
  270.   // Exceptions
  271.   //
  272.   //   None.
  273.   //
  274.   // Notes
  275.   //
  276.   //   This function is used to force execution of an item's exit-msg.
  277.   //
  278.   function exec_exit integer item# returns integer
  279.     local integer retval curItem exitMsg
  280.     if item# eq CURRENT get current_item to curItem
  281.     else move item# to curItem
  282.     get item_exit_msg item curItem to exitMsg
  283.     get item_exit exitMsg curItem to retval
  284.     function_return retval
  285.   end_function
  286.  
  287.  
  288.   //
  289.   // Description
  290.   //
  291.   //   This function invokes the validate-message for the specified item#,
  292.   //   and returns the result; non-zero means that the data entered in the
  293.   //   specified item# is invalid, and that the cursor should stay on the
  294.   //   specified item#.
  295.   //
  296.   // Assumptions/Preconditions
  297.   //
  298.   //   The item# argument must be a valid entry-item index (between 0 and
  299.   //   Item_Count-1), or the sentinel value CURRENT.
  300.   //
  301.   // Exceptions
  302.   //
  303.   //   If the specified item# uses the AUTOFIND option, an entry_autofind
  304.   //   is performed.
  305.   //
  306.   // Notes
  307.   //
  308.   //   This function is used to force execution of an item's validate-msg.
  309.   //
  310.   function exec_validate integer item# returns integer
  311.     local integer retval curItem valMsg chgd autoFlag autoGEFlag
  312.     if item# eq CURRENT get current_item to curItem
  313.     else move item# to curItem
  314.     //
  315.     // check for AUTOFIND, AUTOFIND_GE
  316.     //
  317.     #IFSUB 'AUTOFIND_BIT'
  318.     #ELSE
  319.       #REPLACE AUTOFIND_BIT    0
  320.     #ENDIF
  321.     #IFSUB 'AUTOFIND_GE_BIT'
  322.     #ELSE
  323.       #REPLACE AUTOFIND_GE_BIT 8
  324.     #ENDIF
  325.     get item_changed_State item curItem to chgd
  326.     if chgd ne 0 begin
  327.       get item_option item curItem AUTOFIND_BIT retval
  328.       if retval begin
  329.         get item_option item curItem AUTOFIND_GE_BIT retval
  330.         if retval send entry_autofind GE
  331.         else send entry_autofind EQ
  332.       end
  333.     end
  334.     //
  335.     // validate item
  336.     //
  337.     get Valid_Item item curItem to retval
  338.     function_return retval
  339.   end_function
  340. end_class
  341.  
  342.