[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SET FORMAT

    SET FORMAT activates a format procedure so that whenever a READ is
    performed the format procedure is executed.

Syntax

    SET FORMAT TO <procedure>

Argument

    <procedure> is a format (.fmt) file, a program (.prg) file, or a
    PROCEDURE.

    SET FORMAT TO with no argument deactivates the current format.

Usage

    Format procedures are like any other procedure in Clipper differing
    only by the method by which you invoke them.  Unlike the interpreted
    environment, formats are not opened at runtime and executed when the
    application is run.  Instead, when Clipper encounters a SET FORMAT
    statement while compiling, it attempts to compile the specified file
    from disk as it would any other procedural reference.  Because of this
    general character, format procedures can be stored in procedure files.

    Note: If you are compiling .CLP files with a program that contains
    format references, the accompanying format files must have .prg file
    extensions in order to compile correctly.

    In Clipper there can only be one active format procedure, unlike other
    dialects where each work area can have an active format.

    Format declarations cannot be nested.  Clipper ignores SET FORMAT
    statements within format procedures at compile time.

    Clipper does not clear the screen before executing format files.

    Commands, however, are allowed in format files, which gives more
    flexibility.

    Clipper does not support multiple-page format procedures and so READ
    statements within format procedures are ignored.

Example

    USE Sales                             
    SET FORMAT TO Sales_scr               
    DO WHILE LASTKEY() <> 27              
       APPEND BLANK                       
       READ                               
    ENDDO                                 
                                          
    PROCEDURE Sales_scr                   
    CLEAR                                 
    @ 12, 12 SAY "Branch :  " GET Branch  
    @ 13, 14 SAY "Salesman: " GET Salesman
    RETURN                                

See Also: @...SAY...GET READ
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson