home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / dataflex / verify.pkg < prev    next >
Encoding:
Text File  |  1993-08-10  |  8.9 KB  |  379 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/verify.pkg,v $
  9. //     $Revision: 1.1 $
  10. //     $State: Exp $
  11. //     $Author: james $
  12. //     $Date: 1992/09/08 14:43:10 $
  13. //     $Locker:  $
  14. //
  15. //     $Log: verify.pkg,v $
  16. //Revision 1.1  1992/09/08  14:43:10  james
  17. //Initial revision
  18. //
  19. //Revision 1.3  92/05/14  17:07:33  SWM
  20. //Updated Copyright slug.
  21. //
  22. //Revision 1.2  92/03/09  19:05:46  james
  23. //Added #CHKSUB directive to insure source
  24. //only compiled with correct revision of 
  25. //compiler.
  26. //
  27. //Revision 1.1  91/10/23  10:23:13  elsa
  28. //Initial revision
  29. //
  30. //************************************************************************/
  31.  
  32. //************************************************************************
  33. //     File Name: Verify.Inc
  34. // Creation Date: January 1, 1991
  35. // Modified Date: June 26, 1991
  36. //     Author(s): Steven A. Lowe
  37. //
  38. // This module defines the operations and properties required to support
  39. // prompting of the user prior to save and delete operations, and/or any
  40. // operation(s) which may cause the loss of (changed) data, collected
  41. // in the abstract class Verify_Mixin.
  42. //
  43. // This file should be USEd prior to and IMPORTed within the scope of the
  44. // class definition by any user-interface (esp. data-entry) class which
  45. // must support the data-entry object standards.
  46. //
  47. // This file is used by ENTRYFRM.PKG, TEXT_WIN.PKG, ENCLIENT.PKG, and
  48. // TABLE.PKG.
  49. //************************************************************************/
  50.  
  51. #CHKSUB 1 1 // Verify the UI subsystem.
  52.  
  53. use ui
  54.  
  55. //
  56. // Description
  57. //
  58. //   This statement registers the access function for the Component_State
  59. //   property.  Access to Component_State is required by some of the
  60. //   following operations.
  61. //
  62. // Assumptions/Preconditions
  63. //
  64. //   This object (or one of its ancestor classes) defines such a function.
  65. //
  66. // Exceptions
  67. //
  68. //   None.
  69. //
  70. // Notes
  71. //
  72. //   The Component_State property is defined in the NESTING.INC module,
  73. //   which should be #INCLUDEd prior to this module's inclusion.
  74. //
  75. Register_Function Component_State returns integer
  76.  
  77.  
  78. class verify_mixin is a message
  79.  
  80.   //
  81.   // Description
  82.   //
  83.   //   This procedure defines the properties which are required to support
  84.   //   the verification of saves, deletes, and losses of changed data.
  85.   //
  86.   // Assumptions/Preconditions
  87.   //
  88.   //   None.
  89.   //
  90.   // Exceptions
  91.   //
  92.   //   None.
  93.   //
  94.   // Notes
  95.   //
  96.   //   Though defined as private, access procedures and functions are defined
  97.   //   for these properties below (to make them public).
  98.   //
  99.   //   Verify_Save_Msg holds the message id to be sent to verify a Save
  100.   //   operation.
  101.   //
  102.   //   Verify_Delete_Msg holds the message id to be sent to verify a Delete
  103.   //   operation.
  104.   //
  105.   //   Verify_Data_Loss_Msg holds the message id to be sent to verify an
  106.   //   action which may cause the user to lose changes to the data in items.
  107.   //
  108.   procedure define_verify
  109.     Property integer private.Verify_Save_Msg      PUBLIC 0
  110.     Property integer private.Verify_Delete_Msg    PUBLIC 0
  111.     Property integer private.Verify_Data_Loss_Msg PUBLIC 0
  112.   end_procedure
  113.  
  114.  
  115.   //
  116.   // Description
  117.   //
  118.   //   This procedure sets the value of the Verify_Save_Msg property.
  119.   //
  120.   // Assumptions/Preconditions
  121.   //
  122.   //   None.
  123.   //
  124.   // Exceptions
  125.   //
  126.   //   None.
  127.   //
  128.   // Notes
  129.   //
  130.   //   None.
  131.   //
  132.   procedure set Verify_Save_Msg integer val
  133.     set private.Verify_Save_Msg to val
  134.   end_procedure
  135.  
  136.  
  137.   //
  138.   // Description
  139.   //
  140.   //   This procedure sets the value of the Verify_Delete_Msg property.
  141.   //
  142.   // Assumptions/Preconditions
  143.   //
  144.   //   None.
  145.   //
  146.   // Exceptions
  147.   //
  148.   //   None.
  149.   //
  150.   // Notes
  151.   //
  152.   //   None.
  153.   //
  154.   procedure set Verify_Delete_Msg integer val
  155.     set private.Verify_Delete_Msg to val
  156.   end_procedure
  157.  
  158.  
  159.   //
  160.   // Description
  161.   //
  162.   //   This procedure sets the value of the Verify_Data_Loss_Msg property.
  163.   //
  164.   // Assumptions/Preconditions
  165.   //
  166.   //   None.
  167.   //
  168.   // Exceptions
  169.   //
  170.   //   None.
  171.   //
  172.   // Notes
  173.   //
  174.   //   None.
  175.   //
  176.   procedure set Verify_Data_Loss_Msg integer val
  177.     set private.Verify_Data_Loss_Msg to val
  178.   end_procedure
  179.  
  180.  
  181.   //
  182.   // Description
  183.   //
  184.   //   This function returns the message id to be used to verify a Save
  185.   //   operation.
  186.   //
  187.   // Assumptions/Preconditions
  188.   //
  189.   //   This object must understand Component_State.
  190.   //
  191.   // Exceptions
  192.   //
  193.   //   If this object's Verify_Save_Msg is 0, the value of this object's
  194.   //   parent's Verify_Save_Msg is returned, if any.
  195.   //
  196.   // Notes
  197.   //
  198.   //   None.
  199.   //
  200.   function Verify_Save_Msg returns integer
  201.     local integer retval
  202.     get private.Verify_Save_Msg to retval
  203.     if (retval = 0 AND Component_State(current_object)) ;
  204.         delegate get Verify_Save_Msg to retval
  205.     function_return retval
  206.   end_function
  207.  
  208.  
  209.   //
  210.   // Description
  211.   //
  212.   //   This function returns the message id to be used to verify a Delete
  213.   //   operation.
  214.   //
  215.   // Assumptions/Preconditions
  216.   //
  217.   //   This object must understand Component_State.
  218.   //
  219.   // Exceptions
  220.   //
  221.   //   If this object's Verify_Delete_Msg is 0, the value of this object's
  222.   //   parent's Verify_Delete_Msg is returned, if any.
  223.   //
  224.   // Notes
  225.   //
  226.   //   None.
  227.   //
  228.   function Verify_Delete_Msg returns integer
  229.     local integer retval
  230.     get private.Verify_Delete_Msg to retval
  231.     if (retval = 0 AND Component_State(current_object)) ;
  232.         delegate get Verify_Delete_Msg to retval
  233.     function_return retval
  234.   end_function
  235.  
  236.  
  237.   //
  238.   // Description
  239.   //
  240.   //   This function returns the message id to be used to verify an operation
  241.   //   which may cause the user to lose changes to the data in items.
  242.   //
  243.   // Assumptions/Preconditions
  244.   //
  245.   //   This object must understand Component_State.
  246.   //
  247.   // Exceptions
  248.   //
  249.   //   If this object's Verify_Data_Loss_Msg is 0, the value of this object's
  250.   //   parent's Verify_Data_Loss_Msg is returned, if any.
  251.   //
  252.   // Notes
  253.   //
  254.   //   None.
  255.   //
  256.   function Verify_Data_Loss_Msg returns integer
  257.     local integer retval
  258.     get private.Verify_Data_Loss_Msg to retval
  259.     if (retval = 0 AND Component_State(current_object)) ;
  260.         delegate get Verify_Data_Loss_Msg to retval
  261.     function_return retval
  262.   end_function
  263.  
  264.  
  265.   //
  266.   // Description
  267.   //
  268.   //   This function confirms a Save operation with the user, returning 0 if
  269.   //   the Save should continue, or non-zero if the Save should be aborted.
  270.   //
  271.   // Assumptions/Preconditions
  272.   //
  273.   //   None.
  274.   //
  275.   // Exceptions
  276.   //
  277.   //   If the Verify_Save_Msg function returns 0, no action is taken.
  278.   //
  279.   // Notes
  280.   //
  281.   //   None.
  282.   //
  283.   function Verify_Save returns integer
  284.     local integer msg# retval
  285.     get Verify_Save_Msg to msg#
  286.     if msg# ne 0 begin
  287.       get msg# to retval
  288.       function_return retval
  289.     end
  290.   end_function
  291.  
  292.  
  293.   //
  294.   // Description
  295.   //
  296.   //   This function confirms a Delete operation with the user, returning 0 if
  297.   //   the Delete should continue, or non-zero if the Delete should be aborted.
  298.   //
  299.   // Assumptions/Preconditions
  300.   //
  301.   //   None.
  302.   //
  303.   // Exceptions
  304.   //
  305.   //   If the Verify_Delete_Msg function returns 0, no action is taken.
  306.   //
  307.   // Notes
  308.   //
  309.   //   None.
  310.   //
  311.   function Verify_Delete returns integer
  312.     local integer msg# retval
  313.     get Verify_Delete_Msg to msg#
  314.     if msg# ne 0 begin
  315.       get msg# to retval
  316.       function_return retval
  317.     end
  318.   end_function
  319.  
  320.  
  321.   //
  322.   // Description
  323.   //
  324.   //   This function confirms an operation (which may cause the loss of changed
  325.   //   data in items) with the user, returning 0 if the operation should
  326.   //   continue, or non-zero if the operation should be aborted.
  327.   //
  328.   // Assumptions/Preconditions
  329.   //
  330.   //   None.
  331.   //
  332.   // Exceptions
  333.   //
  334.   //   If the Verify_Data_Loss_Msg function returns 0, no action is taken.
  335.   //
  336.   // Notes
  337.   //
  338.   //   None.
  339.   //
  340.   function Verify_Data_Loss returns integer
  341.     local integer msg# retval
  342.     get Verify_Data_Loss_Msg to msg#
  343.     if msg# ne 0 begin
  344.       get msg# to retval
  345.       function_return retval
  346.     end
  347.   end_function
  348.  
  349.  
  350.   //
  351.   // Description
  352.   //
  353.   //   This function deactivates this object.
  354.   //
  355.   // Assumptions/Preconditions
  356.   //
  357.   //   This object must understand Request_Cancel.
  358.   //
  359.   // Exceptions
  360.   //
  361.   //   None.
  362.   //
  363.   // Notes
  364.   //
  365.   //   None.
  366.   //
  367.   procedure Exit_Function
  368.     local integer isChgd
  369.     if (Component_State(current_object)) ;
  370.         delegate get Changed_State to isChgd
  371.     else get Changed_State to isChgd
  372.     if (isChgd <> 0 AND Verify_Data_Loss(current_object) <> 0) ;
  373.         procedure_return
  374.     send request_cancel
  375.   end_procedure
  376.  
  377. end_class
  378.  
  379.