In order for this site to work correctly, and for us to improve the site, we need to store a small file (called a cookie) on your computer.
By continuing to use this website, you agree to our cookies and privacy policy.
  
Home page Home page Home page Home page
Pixel
Pixel Header R1 C1 Pixel
Pixel Header R2 C1 Pixel
Pixel Header R3 C1 Pixel
Pixel

Reader's Clinic - Scribe Replace Processes in Window

Bryan de Silva at Improvisations wanted the equivalent functionality of the zoom key on a text field without actually using the zoom key. The problem with the zoom key is the user having to learn to press F9, <Esc> to save and return to the window. What was required was a zoom key equivalent that returned to the prompt on an F9 but in all other ways behaved in a standard manner.

This is an ideal application for a Replace Scribe hook in a window. The ability to replace the default scribe process called is a little used feature of AREV, made even less common by the lack of a code and command entry on the PROMPT.ALL window in Paint. The only way to insert the code and command is to edit the template direct, or to use SKELETON (or a modified PROMPT.ALL - one has been uploaded onto Compuserve). The values to edit are 39 and 40 of the prompt the Replace Scribe process is required to be on.

To describe the functionality our Replace Scribe process must provide,

    It must maximise the entry space for the current prompt
    It must visually indicate to the user that this prompt has been "Zoomed"
    It must save and return to the screen on an F9
    It must abandon and return to the screen on an <Esc>.
    It must always be in wrap mode regardless of system default mode
    It must position itself at the current prompt position

The logic to accomplish this is straightforward given an elementary understanding of how scribe works. Rather than explain in detail, a fully commented code listing is presented. This should be called as the Replace Scribe process and will fulfil the criteria above.


0001   subroutine GET
0002   /*
0003     Author    AMcA
0004     Date      July 1991
0005     Note      WC_ and % omitted from Window Common vars for space reasons.
0006               Note that the use of --> is purely to indicate continuation.
0007    */
0008  
0009    $insert INCLUDE, LCPOSITIONS
0010    $insert INCLUDE, LCFUNCTIONS
0011    $insert INCLUDE, WINDOW_COMMON%
0012    $insert INCLUDE, SCRIBE.STATE.CONSTANTS
0013    $insert INCLUDE, SCRIBE.FLAGS.CONSTANTS
0014    declare subroutine scribe, border.up
0015    declare function video.rw
0016  
0017    gosub GET_SCRIBE_PARAMS
0018    SAVE_INSERT = @INSERT<2>
0019    @INSERT<2> = 1 ; * Toggle text wrap on mode
0020    DUMMY = video.rw(COL-1, ROW-1, COL+SI<VLEN>, ROW +
0021  -->  MV_DEPTH, 'R', IMAGE) ; Save screen under prompt
0022    border.up(COL - 1, ROW - 1, COL + SI<VLEN>, ROW +
0023  -->  MV_DEPTH, 2, "") ; Put up Zoom box
0024    scribe(IS, PROTECTED, WEXIT_KEYS,EXCEPT_KEYS, COL, ROW,
0025  -->  SI<VLEN>, COLOUR, SCRIBE_FLAGS, WCHANGE, MV_DEPTH,
0026  -->  WC, SI<VINP>,SI<VOTP>,SI<VJST>,DELIM,SI<MASK>,
0027     --> SI<CHAR.CNT>, SCRIBE_STATE)
0028    DUMMY = video.rw(COL-1,ROW-1,COL+SI<VLEN>,ROW+MV_DEPTH,
0029  -->  'W', IMAGE) ; restore screen
0030   begin case
0031    case WC = F9
0032     * If F9 then fool window into thinking it was just CR
0033     WC = char(13)
0034    case WC = char(27)
0035     * If <esc> then restore old value and treat as CR
0036     WC = char(13)
0037     IS = field(SCRIBE_STATE,@RM,SS.ORIG.VAL)
0038   end case
0039   @INSERT<2> = SAVE_INSERT
0040  return
0041  
0042  GET_SCRIBE_PARAMS:
0043   /*
0044    Note that most scribe parameters can be lifted directly from the current
0045    prompt or WINDOW_COMMON%. The program just needs to set a couple of
0046    starter flags
0047   */
0048   SCRIBE_FLAGS<NOPAINT$>       = 0 ; * Refresh screen
0049   SCRIBE_FLAGS<NO.ORIG.VAL$>   = 0 ; * Keep old value
0050   PROTECTED                    = 0
0051   COL                          = WLX + SI<VX> ; Prompt X
0052   ROW                          = WLY + SI<VY> ; Prompt Y
0053   COLOUR                            = ""
0054   MV_DEPTH                     = @CRTHIGH - ROW - 1
0055  return

(Volume 3, Issue 5, Pages 4,5)
Pixel
Pixel Footer R1 C1 Pixel
Pixel
Pixel
Pixel