home   about us   contact us  
Distribtution
Financial
Appx
News
Search site for:




Menu 'Shortcuts'

Unlike SPEED II, APPX allows us to put fields (modifiable or not) on the images associated with menus. We can take advantage of this to allow the user to enter something directly on the menu, instead of clicking on a choice. This 'shortcut' could refer to any process, not just the ones in the current application or menu.

The approach is this: We'll create a file that contains a user defined code for the shortcut (CUST for Customer File Maintenance, for example) and the application id, process type and process name of the actual APPX process to be invoked. We'll put this field on the menu image as a modifiable field, and in the menu process, test to see if the user entered anything. If they did, we'll run the APPX process indicated by the information in the file.

Let's start with a file to contain our shortcuts:
File     Descriptive Name    Org     File Type      T DP AA RP
======== =================== ======= ============== ==========
SHORTCUT Menu Shortcuts      INDEXED PERMANENT      T DP
This file contains Mnemonics and their associated APPX process. Used in MENUs to allow the user to directly execute a process by entering the Mnemonic.
Seq                       Fld                 D --Stored--- -Options--
No  Field Name            Typ Format          S Start   Len T DL AA KC
--- --------------------- --- --------------- - ----- ----- ----------
100 SHORTCUT CODE         Alp X(6)            1     1     6 T       P
200 SHORTCUT DESCRIPTION  Alp X(20)           1     7    20 T
300 SHORTCUT APPLICATION  Alp X(3)            1    27     3 T
400 SHORTCUT PROC TYPE    Alp X(10), Tbl      1    30    10
500 SHORTCUT PROC NAM     Alp X(30)           1    40    30 T
600 SHORTCUT ADDED BY     Sys User Add        1    70     3
700 SHORTCUT DATE ADDED   Sys Date Add,CC-DD  1    73     5
800 SHORTCUT CHANGED BY   Sys User Chg        1    78     3
900 SHORTCUT DATE CHANGED Sys Date Chg,CC-DD  1    81     5
The SHORTCUT PROC TYPE validation table just contains the normal APPX process types, MENU, JOB, INPUT, etc.

Next, we'll need a process to maintain this file. This is simple enough so we won't go over it in detail here, but there are a couple of 'tricks' to validate that the application, process type and process name really exist. It would also be nice if the user could SCAN the design files. To validate the process type, put the following code in the Verify Event Point:
   SET      --- NEXT APPLICATION           =  TSY SHORTCUT APPLICATION
   SET      --- NEXT VERSION               =  --- VERSION
   OPEN     0AD PROCESS   SHARE? Y  FAIL 0
F  ERROR    No Source Files for specified Application
F  END
   IF       TSY SHORTCUT PROC TYPE         EQ     MENU
T  SET      0AD PROCESS TYPE               =      MENU
   IF       TSY SHORTCUT PROC TYPE         EQ     JOB
T  SET      0AD PROCESS TYPE               =      JOB
   IF       TSY SHORTCUT PROC TYPE         EQ     INPUT
T  SET      0AD PROCESS TYPE               =      INPUT
   IF       TSY SHORTCUT PROC TYPE         EQ     OUTPUT
T  SET      0AD PROCESS TYPE               =      OUTPUT
   IF       TSY SHORTCUT PROC TYPE         EQ     UPDATE
T  SET      0AD PROCESS TYPE               =      UPDATE
   IF       TSY SHORTCUT PROC TYPE         EQ     QUERY
T  SET      0AD PROCESS TYPE               =      QUERY
   IF       TSY SHORTCUT PROC TYPE         EQ     STATUS
T  SET      0AD PROCESS TYPE               =      STATUS
   IF       TSY SHORTCUT PROC TYPE         EQ     INQUIRY
T  SET      0AD PROCESS TYPE               =      INQUIRY
   IF       TSY SHORTCUT PROC TYPE         EQ     SUBROUTINE
T  SET      0AD PROCESS TYPE               =      SUBROUTINE
   SET      0AD PROCESS NAM                =  TSY SHORTCUT PROC NAM
   READ     0AD PROCESS   HOLD 0    FAIL 0    KEY IS  PROCESS KEY
F  ERROR    Process Not Found
F  POSITION TSY SHORTCUT PROC TYPE         (AT APPEARANCE #    )
The reason we have to move constants into the 0AD PROCESS TYPE instead of just moving the SHORTCUT PROC TYPE is that the 0AD field is a token field, and unless our tokens matched exactly, it wouldn't work. There may be more elegant ways of doing this, but this is good enough for the 9 process types we have to deal with.

To let the user SCAN into the Application Design files, put the following code in the Option Intercept Event Point:

     IF       --- OPTION                  EQ     SCAN
T    AT FIELD TSY SHORTCUT APPLICATION    (AT APPEARANCE #    )
TT   SCAN     TSY SHORTCUT APPLICATION    =  0SA APPL ID
T    SET      --- NEXT APPLICATION        =  TSY SHORTCUT APPLICATION
T    SET      --- NEXT VERSION            =  --- VERSION
T    AT FIELD TSY SHORTCUT PROC TYPE      (AT APPEARANCE #    )
TT   IF       TSY SHORTCUT APPLICATION    EQ
TTT  ERROR    Can't SCAN for Processes Until Application is Entered
TTT  END
TT   SCAN     TSY SHORTCUT PROC TYPE      =  0AD PROCESS TYPE
TT   SCAN     TSY SHORTCUT PROC NAM       =  0AD PROCESS NAM
T    AT FIELD TSY SHORTCUT PROC NAM       (AT APPEARANCE #    )
TT   IF       TSY SHORTCUT APPLICATION    EQ
TTT  ERROR    Can't SCAN for Processes Until Application is Entered
TTT  END
TT   SCAN     TSY SHORTCUT PROC TYPE      =  0AD PROCESS TYPE
TT   SCAN     TSY SHORTCUT PROC NAM       =  0AD PROCESS NAM
The way this is written, the user can scan on either the type or name, and both fields are always returned. Note that they have to fill in the application id before they can scan.

Now all we have to do is put the field SHORTCUT CODE on the menu's image as a modifiable field and with DLU to the SHORTCUT file (if we want to be nice...:-). We need some code to see if the user entered anything, and if so, perform the appropriate action. The subroutine that does this is called CHECK FOR SHORTCUT, and contains the following code:

  IF     --- OPTION                  EQ     RETURN
  AND    TSY SHORTCUT CODE           NE
T GOSUB      :RUN SHORTCUT
  *      APPX Bug (?), if RETURN pressed on a menu with a modifiable
  *      field, then field becomes non modifiable, so throw it away
  IF     --- OPTION                  EQ     RETURN
T SET    --- OPTION                  =
  RETURN
  *
  LABEL  :RUN SHORTCUT
  READ   TSY SHORTCUT  HOLD 0 FAIL 0 KEY IS  SHORTCUT CODE
F RETURN
  SET    --- NEXT APPLICATION        =  TSY SHORTCUT APPLICATION
  SET    --- NEXT VERSION            =  --- VERSION
  SET    --- NEXT PROCESS NAME       =  TSY SHORTCUT PROC NAM
  IF     TSY SHORTCUT PROC TYPE      EQ     MENU
T MENU                                     DETACHED    END? N FAIL 0
  IF     TSY SHORTCUT PROC TYPE      EQ     JOB
T JOB                                      DETACHED    END? N FAIL 0
  IF     TSY SHORTCUT PROC TYPE      EQ     INPUT
T INPUT                                    DETACHED    END? N FAIL 0
  IF     TSY SHORTCUT PROC TYPE      EQ     OUTPUT
T OUTPUT                                   DETACHED    END? N FAIL 0
  IF     TSY SHORTCUT PROC TYPE      EQ     UPDATE
T UPDATE                                   DETACHED    END? N FAIL 0
  IF     TSY SHORTCUT PROC TYPE      EQ     QUERY
T QUERY                                    DETACHED    END? N FAIL 0
  IF     TSY SHORTCUT PROC TYPE      EQ     STATUS
T STATUS                                   DETACHED    END? N FAIL 0
  IF     TSY SHORTCUT PROC TYPE      EQ     INQUIRY
T INQUIRY                                  DETACHED    END? N FAIL 0
  IF     TSY SHORTCUT PROC TYPE      EQ     SUBROUTINE
T SUBR                                     DETACHED    END? N FAIL 0
  RETURN
This code is pretty self explanatory. First we check to see if the user entered anything in the shortcut field followed by pressing Return. If so, we read the SHORTCUT table to get the rest of the information we need to run the requested process, set the --- NEXT fields so APPX knows what application, version and process name we want to run, then invoke it directly via the appropriate ILF command (MENU, INPUT, etc). Note that executing these types of ILF commands (MENU, INPUT, etc) without specifying the application or process to run causes APPX to use the contents of NEXT APPLICATION and NEXT PROCESS NAME. Note the business about setting OPTION to blank if it is RETURN. We found that letting APPX process the RETURN key causes the modifiable fields on the menu to become non modifiable, so we just throw the RETURN away.

Now that we have it all set up, we can go to any menu we want, add the SHORTCUT CODE field to the image and GOSUB TSY CHECK FOR SHORTCUT to the Option Intercept Event Point, and we have enabled shortcuts on that menu.

Other enhancements might include restricting certain shortcuts to certain menus, making the shortcuts user specific, or making the input process that maintains the SHORTCUT table the default input process for the table so that users can add their own shortcuts on the fly. In this case, you might also want to only allow MENU, JOB, and INPUT type processes. This would prevent a user from adding a shortcut and then running some UPDATE process. This could be accomplished by modifying the SHORTCUT PROCESS TYPE so it only allows MENU, JOB, and INPUT.


Do you have a tip you want to pass on? Contact Us.


« Return



© Copyright 2009 - C.A.N.S.Y.S. West Limited All Rights Reserved