Reader's Clinic - Scribe Replace Processes in Window

Published ByDateVersionKnowledge LevelKeywords
Sprezzatura Ltd01 OCT 19912.1+EXPERTSCRIBE, REPLACE, ZOOM, WINDOW, SCRIBE.FLAGS.CONSTANTS, SCRIBE.STATE.CONSTANTS, PROMPT.ALL

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.

 subroutine GET
 /*
   Author    AMcA
   Date      July 1991
   Note      WC_ and % omitted from Window Common vars for space reasons.
             Note that the use of --> is purely to indicate continuation.
  */

  $insert INCLUDE, LCPOSITIONS
  $insert INCLUDE, LCFUNCTIONS
  $insert INCLUDE, WINDOW_COMMON%
  $insert INCLUDE, SCRIBE.STATE.CONSTANTS
  $insert INCLUDE, SCRIBE.FLAGS.CONSTANTS
  declare subroutine scribe, border.up
  declare function video.rw

  gosub GET_SCRIBE_PARAMS
  SAVE_INSERT = @INSERT<2>
  @INSERT<2> = 1 ; * Toggle text wrap on mode
  DUMMY = video.rw(COL-1, ROW-1, COL+SI<VLEN>, ROW +
-->  MV_DEPTH, 'R', IMAGE) ; Save screen under prompt
  border.up(COL - 1, ROW - 1, COL + SI<VLEN>, ROW +
-->  MV_DEPTH, 2, "") ; Put up Zoom box
  scribe(IS, PROTECTED, WEXIT_KEYS,EXCEPT_KEYS, COL, ROW,
-->  SI<VLEN>, COLOUR, SCRIBE_FLAGS, WCHANGE, MV_DEPTH,
-->  WC, SI<VINP>,SI<VOTP>,SI<VJST>,DELIM,SI<MASK>,
   --> SI<CHAR.CNT>, SCRIBE_STATE)
  DUMMY = video.rw(COL-1,ROW-1,COL+SI<VLEN>,ROW+MV_DEPTH,
-->  'W', IMAGE) ; restore screen
 begin case
  case WC = F9
   * If F9 then fool window into thinking it was just CR
   WC = char(13)
  case WC = char(27)
   * If <esc> then restore old value and treat as CR
   WC = char(13)
   IS = field(SCRIBE_STATE,@RM,SS.ORIG.VAL)
 end case
 @INSERT<2> = SAVE_INSERT
return

GET_SCRIBE_PARAMS:
 /*
  Note that most scribe parameters can be lifted directly from the current
  prompt or WINDOW_COMMON%. The program just needs to set a couple of
  starter flags
 */
 SCRIBE_FLAGS<NOPAINT$>       = 0 ; * Refresh screen
 SCRIBE_FLAGS<NO.ORIG.VAL$>   = 0 ; * Keep old value
 PROTECTED                    = 0
 COL                          = WLX + SI<VX> ; Prompt X
 ROW                          = WLY + SI<VY> ; Prompt Y
 COLOUR                            = ""
 MV_DEPTH                     = @CRTHIGH - ROW - 1
return

(Volume 3, Issue 5, Pages 4,5)

  • tips/revmedia/v3i5a2.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1