tips:revmedia:v3i5a3

Soft Windows

Published ByDateVersionKnowledge LevelKeywords
Sprezzatura Ltd01 OCT 19912.1+EXPERTWINDOW, TEMPLATE, LCPOSITIONS, @RECORD

The biggest problem confronting developers when modifying the display characteristics of window at a pre-init stage (E.G. to remove prompts the user does not have access to, or to change screen wording) is that of changing the stored literal image. The format of this image is open to understanding and thus can be customised on the fly (a subject for a later REVMEDIA) but there are easier ways to actually force the window processor to do the work on the developer's behalf.

The compiled screen information is stored in the template record in the ninth substring delimited by Char(247)s. At the pre-init stage this may be accessed from @RECORD. If at this stage this is nulled down, the window processor will rebuild it from scratch using the information current in the prompts in @RECORD. Thus in the case of replacing all of the screen prompts and the screen title with, for example, a different language version, one would

   subroutine WINDOW_SOFT
   /*
   Author     AMcA
   Date       July 1991
   Purpose    To replace the on screen messages & title with local language version
   Copyright  Sprezzatura Ltd 1991
   */

   equ DLM$   to char(247)
   * Firstly remove literals by fieldstoring null
   @RECORD = fieldstore(@RECORD, DLM$,9,1,"")
   /*
      Now assume P contains @FM delimited list of new prompt messages and T
      contains new window title
   */
   * Store title in @RECORD
   @RECORD = fieldstore(@RECORD, DLM$, 6, 1, T)
   * Now store prompts in @RECORD
   TOP = @RECORD<1> + 1
   for X = 2 to TOP
    /*
      check to see if prompt hidden, if so don't bother replacing literal.
      Hidden info is MV 53 of current prompt
    */
    if @RECORD<X,53> = "" then
      @RECORD<X,5> = P<X-1>
     end
   next
  return

This approach could be extended to build completely new windows on the fly, be it data entry windows or simply collector windows. Thus if in a program, parameters were needed to define the scope of a report (dates, amounts etc), a generic subroutine could be written to collect the necessary information. A sample generic subroutine follows -

  subroutine GENERIC_COLLECTOR(PROMPTS, TITLE)
  /*
    Author  AMcA
    Date    August 1991
    Purpose To provide a generic collector for report programs. PROMPTS will
            contain an @FM delimited list to include on the window, with
            each field being in the form PROMPT_TYPE : "|" : PROMPT_LABEL
  */

    $insert include, lcpositions
    equ DLM$ to char(247) ; * Template delimiter char
    MARK = 0 ; POS = 0 ; @RECORD = ""
    loop
     remove NP from PROMPTS at POS setting MARK
    while NP do
     PT = NP[1,"|"] ; * Type, D-Date, A-Amount etc
     PL = NP[-1,"B|"] ; *Prompt Label
     NUM = @RECORD<1> + 1 ; * Increment prompt count
     @RECORD<1> = NUM
     PROMPT = ""
     PROMPT<0,TYPE> = "F"
     PROMPT<0,FNO> = NUM
     PROMPT<0,D> = PL
     PROMPT<0,DX> = 2
     PROMPT<0,DY> = NUM * 2 - 1
     PROMPT<0,VX> = 20
     PROMPT<0,VY> = NUM * 2 - 1
     PROMPT<0,VJST> = "L"
     PROMPT<0,VLEN> = 15
     * Add in prompt type specific logic
     begin case
      case PT = "D"
       PROMPT<0,VOTP> = "DE"
       PROMPT<0,VINP> = "(DE)"
      case PT = "A"
       PROMPT<0,VOTP> = "MD2,"
       PROMPT<0,VINP> = "(MD2)"
     end case
     @RECORD<-1> = PROMPT
    repeat
    * Set up virtual screen measurements
    DEPTH = NUM * 2 + 4
    @RECORD<-1> = 20 : @FM : 4 : @FM
    @RECORD := 60 : @FM : DEPTH
    @RECORD := DLM$:60:@FM:DEPTH:@FM:
    @RECORD := 60:@FM:DEPTH:@FM:0:DLM$
    @PSEUDO = @RECORD
    @PSEUDO = fieldstore(@PSEUDO,DLM$,6,1,TITLE)
    COL = str(@FM,5) : 1 ; * Collector parameters
    @PSEUDO = fieldstore(@PSEUDO,DLM$,13,1,COL)
    call catalyst("W", ". NOREAD")
  return

(Volume 3, Issue 5, Pages 6,7)

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