Module navigate.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\navigate.pkg,v $
    10//     $Revision: 1 $
    11//     $State: Exp $
    12//     $Author: james $
    13//     $Date: Apr 01 16:09:14 1997 $
    14//     $Locker:  $
    15//
    16//     $Log: navigate.pkg,v $
    17//Revision 2.3  1993/11/19  03:43:23  james
    18//Fixed bug in Request_Cancel message.
    19//
    20//Revision 2.2  1993/09/28  21:51:47  lee
    21//request_cancel now checks verify_data_loss. only a partial fix, though. real
    22//fix rqeuires lots of messy code that will have to wait for item/focus movement
    23//redesign.
    24//
    25//Revision 1.2  1993/04/28  00:20:34  james
    26//Initializing 3.04 source code.
    27//
    28//Revision 1.1  1992/09/08  14:43:07  james
    29//Initial revision
    30//
    31//Revision 1.4  92/05/14  15:49:42  unknown
    32//Updated Copyright slug - SWM.
    33//
    34//Revision 1.3  92/04/01  00:33:36  lee
    35//removed navstart and liststart (unused), renamed bind_main_file and bind_index
    36//in datalist to bind_list_main_file and bind_list_index to avoid conflict with
    37//commands used by data_set, moved bind_static from sellist to datalist as it
    38//only sets properties defined in datalist (not sellist).
    39//
    40//Revision 1.2  92/03/09  19:03:38  james
    41//Added #CHKSUB directive to insure source
    42//only compiled with correct revision of
    43//compiler.
    44//
    45//Revision 1.1  91/10/23  10:21:48  elsa
    46//Initial revision
    47//
    48//************************************************************************/
    49
    50//************************************************************************
    51//     File Name: Navigate.Inc
    52// Creation Date: January 1, 1991
    53// Modified Date: June 26, 1991
    54//     Author(s): Steven A. Lowe
    55//
    56// This module defines the basic data-entry object operations and
    57// properties, collected in the abstract class Navigate_Mixin.
    58//
    59// This file should be USEd prior to and IMPORTed within the scope of the
    60// class definition by any user-interface (esp. data-entry) class which
    61// must support the data-entry object standards.
    62//
    63// This file is used by ENTRYFRM.PKG, WIDELIST.PKG, TEXT_WIN.PKG, and
    64// ENCLIENT.PKG.
    65//************************************************************************/
    66
    67
    68//
    69// Description
    70//
    71//   Defines the panel navigation keys if necessary.
    72//
    73// Assumptions/Preconditions
    74//
    75//   None.
    76//
    77// Exceptions
    78//
    79//   If kSwitch_Panel and kSwitch_Panel_Back are already defined, no
    80//   action is taken.
    81//
    82// Notes
    83//
    84//   Used in on-key commands in define_navigation, below.
    85//
    86#IFDEF kSwitch_Panel
    87#ELSE
    88  #REPLACE kSwitch_Panel KEY_ALT+KEY_F6
    89#ENDIF
    90#IFDEF kSwitch_Panel_Back
    91#ELSE
    92  #REPLACE kSwitch_Panel_Back KEY_CTRL+KEY_F6
    93#ENDIF
    94
    95
    96//
    97// Description
    98//
    99//   Define a synonym for Request_Cancel.
   100//
   101// Assumptions/Preconditions
   102//
   103//   None.
   104//
   105// Exceptions
   106//
   107//   If MSG_CANCEL_SCOPE is already defined, no action is taken.
   108//
   109// Notes
   110//
   111//   Defined for historical reasons.
   112//
   113#IFDEF MSG_CANCEL_SCOPE
   114#ELSE
   115  #REPLACE MSG_CANCEL_SCOPE MSG_REQUEST_CANCEL
   116#ENDIF
   117
   118#CHKSUB 1 1 // Verify the UI subsystem.
   119
   120use VDFBase.pkg
   121
   122
   123register_function verify_data_loss returns integer
   124
   125class navigate_mixin is a mixin
   126
   127  //
   128  // Description
   129  //
   130  //   This procedure defines the accelerator keys and properties required to
   131  //   support the data-entry object navigation standard.
   132  //
   133  // Assumptions/Preconditions
   134  //
   135  //   This procedure should only be invoked by the Construct_Object procedure
   136  //   of a class definition.
   137  //
   138  // Exceptions
   139  //
   140  //   None.
   141  //
   142  // Notes
   143  //
   144  //   Auto_Top_Panel_State determines if the Clear operation should rotate
   145  //   to the first object/item in the current group.
   146  //
   147  //   Verify_Exit_Msg holds a message id (function) which is used to prompt
   148  //   the user during exit confirmation.  If Verify_Exit_Msg is 0, the user
   149  //   will not be prompted to confirm exit.  Verify_Exit_Msg is a private
   150  //   property, but access operations are defined below to allow it to be
   151  //   visible (public).
   152  //
   153  { MethodType=Event Visibility=Private }
   154  procedure define_navigation
   155    on_key kBegin_of_Panel    SEND Beginning_of_Panel PRIVATE
   156    on_key kCancel            SEND Request_Cancel     PRIVATE
   157    on_key kEnd_of_Panel      SEND End_of_Panel       PRIVATE
   158    on_key kExit_Function     SEND Exit_Function      PRIVATE
   159    on_key kSwitch            SEND Switch             PRIVATE
   160    on_key kSwitch_Back       SEND Switch_Back        PRIVATE
   161    { Category=Behavior }
   162    { PropertyType=Boolean }
   163    Property Integer Auto_Top_Panel_State             True
   164    { Visibility=Private }
   165    Property integer private.Verify_Exit_Msg          0
   166  end_procedure
   167
   168
   169  //
   170  // Description
   171  //
   172  //   This function returns a message id to be used to prompt the user
   173  //   during exit confirmation, or it returns 0.
   174  //
   175  // Assumptions/Preconditions
   176  //
   177  //   This object must understand the Get_Component_State message (defined
   178  //   in NESTING.PKG).
   179  //
   180  // Exceptions
   181  //
   182  //   None.
   183  //
   184  // Notes
   185  //
   186  //   If this object's Verify_Exit_Msg is 0, this function returns the value
   187  //   of the parent object's Verify_Exit_Msg, if this object has a parent
   188  //   (indicated by Component_State = TRUE).
   189  //
   190  { MethodType=Property }
   191  Function Verify_Exit_msg Returns Integer
   192    integer msg#
   193    get private.verify_exit_msg to msg#
   194    if (msg# = 0 AND Component_State(self)) ;
   195        delegate get verify_exit_msg to msg#
   196    function_return msg#
   197  end_function
   198
   199
   200  //
   201  // Description
   202  //
   203  //   This procedure sets the value of the Verify_Exit_Msg property.
   204  //
   205  // Assumptions/Preconditions
   206  //
   207  //   msg# should be a vlid messaage id, or 0.
   208  //
   209  // Exceptions
   210  //
   211  //   None.
   212  //
   213  // Notes
   214  //
   215  //   None.
   216  //
   217  { MethodType=Property }
   218  { InitialValue=(RefFunc(Exit_Loss_Confirmation)) }
   219  { Category=Data }
   220  Procedure Set Verify_Exit_msg Integer msg#
   221    set private.verify_Exit_Msg to msg#
   222  end_procedure
   223
   224
   225  //
   226  // Description
   227  //
   228  //   This function sends the message which this object uses to prompt the
   229  //   user during exit confirmation.  The result of the message-send is
   230  //   returned.  A return value of 0 means that exit should continue, a non-
   231  //   zero return value means that exiting should be aborted.
   232  //
   233  // Assumptions/Preconditions
   234  //
   235  //   None.
   236  //
   237  // Exceptions
   238  //
   239  //   If this object has no message with which to prompt the user, this
   240  //   function returns 0 to permit exit without confirmation.
   241  //
   242  // Notes
   243  //
   244  //   None.
   245  //
   246  function Verify_Exit returns integer
   247    Integer msg#
   248    get verify_Exit_msg to msg#
   249    if msg# ne 0 get msg# to msg#
   250    function_return msg#
   251  end_function
   252
   253
   254  #IFSUB 'AREA_FLAG'
   255  #ELSE
   256    #REPLACE AREA_FLAG 3  //scope AND popup
   257  #ENDIF
   258
   259
   260  //
   261  // Description
   262  //
   263  //   This procedure deactivates this object and ensures that the focus after
   264  //   deactivation is not an object which should be 'skipped' (in rotation,
   265  //   e.g. an action-bar), if possible.
   266  //
   267  // Assumptions/Preconditions
   268  //
   269  //   This object must understand the Deactivate, Component_State,
   270  //   Changed_state, Focus, Verify_exit and Verify_data_loss messages.
   271  //   The focus must understand the Skip_state and Switch messages.
   272  //
   273  // Exceptions
   274  //
   275  //   Deactivation may be cancelled by the user via the Verify_Exit function.
   276  //
   277  // Notes
   278  //
   279  //   The deactivate message-send passes AREA_FLAG, which means that we want
   280  //   to deactivate the object in the focus tree which is either a scope
   281  //   (i.e. Scope_State = TRUE) or a pop-up (i.e. PopUp_State = TRUE), and
   282  //   which is closest to this object in an 'upward' direction (i.e.
   283  //   client/parent, not child or sibling).
   284  //
   285  procedure Request_Cancel
   286    Integer foc#
   287    if (verify_exit(self) = 0) begin
   288      send deactivate AREA_FLAG
   289      get focus of desktop to foc#
   290      If (foc# and skip_State(foc#)) send switch to foc#
   291    end
   292  end_procedure
   293
   294
   295
   296  //
   297  // Description
   298  //
   299  //   This procedure deactivates this object.
   300  //
   301  // Assumptions/Preconditions
   302  //
   303  //   This object understands Request_Cancel
   304  //
   305  // Exceptions
   306  //
   307  //   None.
   308  //
   309  // Notes
   310  //
   311  //   None.
   312  //
   313  procedure Exit_Function
   314    send request_cancel
   315  end_procedure
   316
   317end_class
   318
   319
   320