Module verify.pkg

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