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

Soft Windows

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


0001     subroutine WINDOW_SOFT
0002     /*
0003     Author     AMcA
0004     Date       July 1991
0005     Purpose    To replace the on screen messages & title with local language version
0006     Copyright  Sprezzatura Ltd 1991
0007     */
0008  
0009     equ DLM$   to char(247)
0010     * Firstly remove literals by fieldstoring null
0011     @RECORD = fieldstore(@RECORD, DLM$,9,1,"")
0012     /*
0013        Now assume P contains @FM delimited list of new prompt messages and T
0014        contains new window title
0015     */
0016     * Store title in @RECORD
0017     @RECORD = fieldstore(@RECORD, DLM$, 6, 1, T)
0018     * Now store prompts in @RECORD
0019     TOP = @RECORD<1> + 1
0020     for X = 2 to TOP
0021      /*
0022        check to see if prompt hidden, if so don't bother replacing literal.
0023        Hidden info is MV 53 of current prompt
0024      */
0025      if @RECORD<X,53> = "" then
0026        @RECORD<X,5> = P<X-1>
0027       end
0028     next
0029    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 -


0001    subroutine GENERIC_COLLECTOR(PROMPTS, TITLE)
0002    /*
0003      Author  AMcA
0004      Date    August 1991
0005      Purpose To provide a generic collector for report programs. PROMPTS will
0006              contain an @FM delimited list to include on the window, with
0007              each field being in the form PROMPT_TYPE : "|" : PROMPT_LABEL
0008    */
0009  
0010      $insert include, lcpositions
0011      equ DLM$ to char(247) ; * Template delimiter char
0012      MARK = 0 ; POS = 0 ; @RECORD = ""
0013      loop
0014       remove NP from PROMPTS at POS setting MARK
0015      while NP do
0016       PT = NP[1,"|"] ; * Type, D-Date, A-Amount etc
0017       PL = NP[-1,"B|"] ; *Prompt Label
0018       NUM = @RECORD<1> + 1 ; * Increment prompt count
0019       @RECORD<1> = NUM
0020       PROMPT = ""
0021       PROMPT<0,TYPE> = "F"
0022       PROMPT<0,FNO> = NUM
0023       PROMPT<0,D> = PL
0024       PROMPT<0,DX> = 2
0025       PROMPT<0,DY> = NUM * 2 - 1
0026       PROMPT<0,VX> = 20
0027       PROMPT<0,VY> = NUM * 2 - 1
0028       PROMPT<0,VJST> = "L"
0029       PROMPT<0,VLEN> = 15
0030       * Add in prompt type specific logic
0031       begin case
0032        case PT = "D"
0033         PROMPT<0,VOTP> = "DE"
0034         PROMPT<0,VINP> = "(DE)"
0035        case PT = "A"
0036         PROMPT<0,VOTP> = "MD2,"
0037         PROMPT<0,VINP> = "(MD2)"
0038       end case
0039       @RECORD<-1> = PROMPT
0040      repeat
0041      * Set up virtual screen measurements
0042      DEPTH = NUM * 2 + 4
0043      @RECORD<-1> = 20 : @FM : 4 : @FM
0044      @RECORD := 60 : @FM : DEPTH
0045      @RECORD := DLM$:60:@FM:DEPTH:@FM:
0046      @RECORD := 60:@FM:DEPTH:@FM:0:DLM$
0047      @PSEUDO = @RECORD
0048      @PSEUDO = fieldstore(@PSEUDO,DLM$,6,1,TITLE)
0049      COL = str(@FM,5) : 1 ; * Collector parameters
0050      @PSEUDO = fieldstore(@PSEUDO,DLM$,13,1,COL)
0051      call catalyst("W", ". NOREAD")
0052    return

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