home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / dbase / ccb_fix.arj / CCB_FORM.LST < prev   
Encoding:
File List  |  1991-06-09  |  113.0 KB  |  2,787 lines

  1.     1:  // Module Name: CCB_FORM.COD
  2.     2:  // Description: This module produces dBASE IV .FMT files
  3.     3:  //              with popups or BROWSE for VALID clause field validation
  4.     4:  //              and/or Context Sensitive Help for each field.
  5.     5:  //
  6.     6:  
  7.     7:  Format (.fmt) File Template with POPUP or BROWSE field validation
  8.     8:  -----------------------------------------------------------------
  9.     9:  Version 1.11.33
  10.    10:  Ashton-Tate (c) 1987, 1988, 1989, 1990
  11.    11:  Written by Kirk J. Nason & Bill Ramos
  12.    12:  
  13.    13:  ════════════════════════════════════════════════════════════════════════════════
  14.    14:           *****  NOT AN OFFICIAL ASHTON-TATE RELEASE OF FORM.GEN  *****
  15.    15:              Key assignments and features could change WITHOUT notice
  16.    16:  
  17.    17:  GENERAL NOTE:
  18.    18:    dBASE has a new REQUIRED keyword for the @ GET command. Currently the
  19.    19:    Screen Designer does not have a option for this!  If you want the 
  20.    20:    REQUIRED keyword after every VALID use the DOS environment variable:
  21.    21:    SET DTL_REQ=ON and restart dBASE.  NOW every generated VALID will look like
  22.    22:    @ <row>,<col> ... GET <var> VALID REQUIRED <exp>
  23.    23:    This environment variable will be removed at some future date!
  24.    24:  
  25.    25:  ════════════════════════════════════════════════════════════════════════════════
  26.    26:  
  27.    27:  This template will support POPUPs or BROWSE for VALID clause field validations
  28.    28:  and context sensitive help for each field.  If you choose these features,
  29.    29:  please note the following:  F1: calls the context sensitive help,  F2:(switch to
  30.    30:  edit/browse) is disabled, but if the ZOOM option is used F9 will ZOOM to another 
  31.    31:  form,  F6:invokes the "cut" portion of cut/paste,  Ctrl-F5:invokes editing of 
  32.    32:  "cut" data, and  F8:invokes the "paste" code,  F7:Allows you to move "windows"
  33.    33:  around.
  34.    34:  
  35.    35:  Example:
  36.    36:   In FORM Design - "ACCEPT value when" under "Edit options" enter,
  37.    37:   "POPUP" = "vendor->vendor_id ORDER vendor_id REQ SHADOW ZOOM vendors"
  38.    38:   "BROWSE" ="vendor->vendor_id ORDER vendor_id FIELDS id,name FROM 5,0 TO 6,30"
  39.    39:   -------------------------------------------------------------------------------
  40.    40:   this will activate a popup or BROWSE if the data entered is invalid for
  41.    41:   that field and will also make the field REQUIRED.
  42.    42:  
  43.    43:  ************   SET DBTRAP OFF  is required to use these features  ************
  44.    44:  
  45.    45:  Explanation of the string follows:
  46.    46:  
  47.    47:  POPUP               Indicates that a POPUP will be used for this field.
  48.    48:  BROWSE              Indicates that BROWSE will be used for this field.
  49.    49:  <file>-><fieldname> Indicates the .DBF to open and FIELD to use as validation.
  50.    50:  ORDER <tag name>    Indicates which INDEX TAG to SEEK in.            
  51.    51:  REQ                 Indicates the FIELD requires data (can't be left empty).
  52.    52:                      Leave REQ out if the field is NOT required.      OPTIONAL!
  53.    53:  SHADOW              Use shadowing effect on POPUPs or BROWSE.        OPTIONAL!
  54.    54:  
  55.    55:  FROM <r,c> TO <r,c> Window coordinates for the BROWSE table.         OPTIONAL!
  56.    56:  FIELDS <fld list>   Field list for the BROWSE table.                 OPTIONAL!
  57.    57:  UPDATE              Allow APPENDing and EDITing of BROWSE table.     OPTIONAL!
  58.    58:                      Note: "FIELDS <fld list>" is REQUIRED for UPDATE
  59.    59:  FORMAT <file name>  Format file to use with BROWSE FORMAT            OPTIONAL!
  60.    60:                      Note: overrides FIELDS <fld list>
  61.    61:  ZOOM <file name>    Format file to use with "ZOOMed" EDIT            OPTIONAL!
  62.    62:                      Note: Zooms to EDIT another FORM based on file->fieldname
  63.    63:                            info above.
  64.    64:  NOTE: The string must be entered with the quotes as in the example.  
  65.    65:  
  66.    66:  ════════════════════════════════════════════════════════════════════════════════
  67.    67:  
  68.    68:  Explanation of the Context Sensitive Help file follows:
  69.    69:  
  70.    70:  If you want to create your own help file, here is the structure that is required.
  71.    71:  
  72.    72:  Structure for Help Database (.dbf):
  73.    73:  <first 6 chars. of the format filename>_H.dbf
  74.    74:                         ---------------
  75.    75:  
  76.    76:  Field   Field Name  Type        Width  Dec   Tag
  77.    77:  -------------------------------------------------
  78.    78:      1   FLD_NAME    Character     10         Yes  Field name to lookup on F1
  79.    79:      2   FLD_HEADNG  Character     25          No  Heading to show user on window
  80.    80:      3   FLD_HELP    Memo          10          No  Help text to show user
  81.    81:  -------------------------------------------------
  82.    82:          Total                     46
  83.    83:  {
  84.    84:  include "ccb_form.def"    // Form selectors
  85.     1:  //---------------------------------------------------------------------------
  86.     2:  // FORM.DEF     NPI form object data selectors
  87.     3:  // Ashton-Tate (c) 1987, 1988
  88.     4:  //
  89.     5:  // Updated 9-21-88 KJN
  90.     6:  //
  91.     7:  // This include file contains all the selectors required for forms.
  92.     8:  // *** DO NOT CHANGE ANY OF THE NUMBERS BELOW ***
  93.     9:  //
  94.    10:  //---------------------------------------------------------------------------
  95.    11:  // NOTE:
  96.    12:  // Selectors listed in the following table which are shown to have
  97.    13:  // "Value: Number" will sometimes return the null string instead
  98.    14:  // of the numeric zero.  For logical compares, null is the same
  99.    15:  // as zero, however when emitting the value to the output file
  100.    16:  // the null string must be converted to a numeric zero explicitly.
  101.    17:  // A user defined function is used in the FORM.COD template program
  102.    18:  // called NUL2ZERO() for converting null strings to explicit numeric
  103.    19:  // zeros.
  104.    20:  //---------------------------------------------------------------------------
  105.    21:  { 
  106.    22:  selectors
  107.    23:  #lstoff
  108.   138:  ;                       
  109.   139:  //
  110.   140:  // Values returned by Fld_Fieldtype
  111.   141:  //
  112.   142:  enum dbf = 0,    // Field from a database
  113.   143:       calc,       // Calculated expression
  114.   144:       sum,        // Summary ie. Average, Count, etc.
  115.   145:       predef,     // Predefined ie. Date, Page, etc.
  116.   146:       memvar;     // Memvar reference
  117.   147:  
  118.   148:  enum  on_key_help    = "F1",        // Help procedure key
  119.   149:        on_key_toggle  = "F3"        // Previous screen Toggle
  120.   150:        on_key_recalc  = "F5",        // Recalc expressions - not used yet
  121.   151:        on_key_cut     = "F6",        // Cut data to variable
  122.   152:        on_key_edpaste = "Ctrl-F5",    // Edit Paste data
  123.   153:        on_key_move    = "F7",        // Move active window
  124.   154:        on_key_paste   = "F8",        // Paste Cut Data
  125.   155:        on_key_zoom    = "F9";        // Zoom to Form
  126.   156:  
  127.   157:  //
  128.   158:  // Enum string constants for international translation
  129.   159:  //
  130.   160:  enum  wrong_class = "Can't use FORM.GEN on non-form objects.  ",
  131.   161:        form_empty  = "Form design was empty.  ",
  132.   162:        bad_pick    = "Picklist coordinates exceed column 79 - move field left",
  133.   163:        bad_shadow  = "Shadow coordinates exceed column 79 - move field left",
  134.   164:        dbtrap_err  = "ERROR - SET DBTRAP OFF to use this FORM.",
  135.   165:        use_err     = "not found!",
  136.   166:        select_msg1 = "[Select:]+CHR(17)+CHR(196)+CHR(217)+[   Cancel:Esc]",
  137.   167:        select_msg2 = "[   Pan Left:F3   Pan Right:F4   Move Window:" +
  138.   168:                       on_key_move +"]",
  139.   169:        paste_msg1  = " - cut to scrap.   Edit:" + on_key_edpaste +
  140.   170:                      "   Paste:"+ on_key_paste,
  141.   171:        paste_msg2  = "Editing paste string.   Move Window:F7",
  142.   172:        wind_msg1   = "[Position: ]+CHR(27)+CHR(26)+CHR(25)+CHR(24)+[   Exit: Esc]",
  143.   173:        help_msg1   = "Scroll thru Help:Ctrl-Home   Exit Viewing Help:Esc   ",
  144.   174:        help_msg2   = "See Original Screen:" + on_key_toggle,
  145.   175:        hit_any_key = "Hit any key to try again",
  146.   176:        more_info_needed = "You did not enter all the required information"
  147.   177:  ;
  148.   178:  
  149.   179:  }
  150.   180:     85:  include "builtin.def" // Builtin functions
  151.     1:  //---------------------------------------------------------------------------
  152.     2:  // BUILTIN.DEF  Template builtin function selectors
  153.     3:  // Ashton-Tate (c) 1987, 1988, 1989, 1990
  154.     4:  //
  155.     5:  // Updated 3-14-90 KJN
  156.     6:  // Added common UDF's to bottom of builtin.def
  157.     7:  //
  158.     8:  // --------------------------------------------------------------
  159.     9:  // Builtin Functions 
  160.    10:  // --------------------------------------------------------------
  161.    11:  // This set of selectors designate builtin functions which should
  162.    12:  // appear in templates as <selector>([parm][,parm]...)
  163.    13:  // They must be included in every template.
  164.    14:  //
  165.    15:  // *** DO NOT CHANGE ANY OF THE NUMBERS BELOW ***
  166.    16:  //
  167.    17:  //---------------------------------------------------------------------------
  168.    18:  {
  169.    19:  selectors
  170.    20:  #lstoff
  171.   201:  ;
  172.   202:  }
  173.   203:  {
  174.   204:  //--------------------------------------------------------------
  175.   205:  // Enum Statements for dBASE IV internal Settings
  176.   206:  // Use with functions numset() & strset()
  177.   207:  //
  178.   208:  // For convience this enum declaration has been placed in this 
  179.   209:  // file, since they can be used in all design objects
  180.   210:  //--------------------------------------------------------------
  181.   211:  // Enum for numset()
  182.   212:  // Note: FSE = Full Screen Edit
  183.   213:  //
  184.   214:  enum _device_file = 0,  //  0 File handle for SET DEVICE TO <filename> 
  185.   215:       _blocksize ,       //  1 Number of 512-byte pages in DBT     
  186.   216:       _flgalter ,        //  2 Output routed to alt. file        
  187.   217:       _flgbell  ,        //  3 Bell 0:off 1:on
  188.   218:       _flgcarry ,        //  4 Carry 0:off 1:on
  189.   219:       _flgcent  ,        //  5 Use 4-digit years            
  190.   220:       _flgclock ,        //  6 Clock 0:off 1:on
  191.   221:       _flgcnfrm ,        //  7 Confirm 0:off 1:on
  192.   222:       _flgcolor ,        //  8 Color set flag 0=b/w 1=cga 2=ega24 4=mono43
  193.   223:                          //                  6=ega43  3 & 5=N/A
  194.   224:       _flgconsole,       //  9 Console 0:off 1:on
  195.   225:       _flgcrypt ,        // 10 File encryption 0:off 1:on
  196.   226:       _flgcursgn,        // 11 Currency symbol display 0:left 1:right 
  197.   227:       _flgdebug ,        // 12 Route STEP, ECHO to printer 0:off 1:on
  198.   228:       _flgdelete,        // 13 Deleted records vanish 0:off 1:on
  199.   229:       _flgdelim ,        // 14 Delimiters 0:off 1:on
  200.   230:       _flgdesign,        // 15 Design mode 0:off 1:on
  201.   231:       _flgdev ,            // 16 Always compile file 0:off 1:on
  202.   232:       _flgdohist,        // 17 Do History 0:off 1:on
  203.   233:       _flgecho  ,        // 18 Echo 0:off 1:on
  204.   234:       _flgesc   ,        // 19 Escape 0:off 1:on
  205.   235:       _flgexact ,        // 20 Exact 0:off 1:on
  206.   236:       _flgexcl  ,        // 21 Exclusive 0:off 1:on
  207.   237:       _flgfield ,        // 22 fields 0:off 1:on
  208.   238:       _flgfixed ,        // 23 Fixed point 0:off 1:on
  209.   239:       _flgflush ,        // 24 Autosave 0:off 1:on
  210.   240:       _flghead  ,        // 25 Headings on DISPLAY, SUM, etc. 0:off 1:on
  211.   241:       _flghelp  ,        // 26 Offer help on error 0:off 1:on
  212.   242:       _flghist  ,        // 27 History 0:off 1:on
  213.   243:       _flginstruct,      // 28 Instruct 0:off 1:on
  214.   244:       _flginten ,        // 29 High intensity 0:off 1:on
  215.   245:       _flgmenu  ,        // 30 Put menus up in FSE 0:off 1:on
  216.   246:       _flgnear  ,        // 31 Stay at next record if SEEK/FIND fail 0:off 1:on
  217.   247:       _flgprint ,        // 32 Route output to printer        
  218.   248:       _flgscore ,        // 33 FALSE:  screen doesn't use line 0    
  219.   249:       _flgscprt ,        // 34 0:@'s to screen 1:  @'s routed to printer        
  220.   250:       _flgshare ,        // 35 Allow shared access to databases    
  221.   251:       _flgspace ,        // 36 Set space ON/off (for print engine). 
  222.   252:       _flgsql,            // 37 0: dBASE mode 1: SQL mode      
  223.   253:       _flgsqlcode,       // 38 1: executing SQL generated cmds   
  224.   254:       _flgstatus,        // 39 Status 0:off 1:on
  225.   255:       _flgstep,          // 40 Single-step DO files 0:off 1:on
  226.   256:       _flgtalk ,         // 41 Talk 0:off 1:on
  227.   257:       _flgtitle,         // 42 Titles 0:off 1:on
  228.   258:       _flgtrap,            // 43 Trap 0:off 1:on
  229.   259:       _flguniq,          // 44 Indices 0:Non-unique 1: Unique keys
  230.   260:       _flgautolk,        // 45 Automatic lock flag for network 0:off 1:on
  231.   261:       _flgrefresh,       // 46 The refresh count Returns: Number
  232.   262:       _memowidth,        // 47 Displayed width of memo fields Returns: Number
  233.   263:       _mindec,           // 48 Minimum (or fixed) # decimals Returns: Number
  234.   264:       _odometer,         // 49 Interval odometer is updated Returns: Number
  235.   265:       _safety,           // 50 Safety 0:off 1:on
  236.   266:       _setmrgn,          // 51 Printer left margin Returns: Number
  237.   267:       _reprocess,        // 52 Reprocess count Returns: Number
  238.   268:       _nbuffers,         // 53 Maximum number of I/O buffers Returns: Number
  239.   269:       _lenYNOF           // 54 Default max of YES/NO/ON/OFF 
  240.   270:  ;
  241.   271:  //
  242.   272:  // Enum for strset()
  243.   273:  // Note: FSE = Full Screen Edit
  244.   274:  //
  245.   275:  enum _getdelim = 0,     //  0 FSE l,r delimiters        
  246.   276:       _disp_currency,    //  1 Current FSE currency string 
  247.   277:       _def_currency,     //  2 Default FSE currency string 
  248.   278:       _lang_type,        //  3 Language type designator string
  249.   279:       _wordproc,            //  4 Program used for memo fields
  250.   280:       _tedit,            //  5 Program used for MODIFY COMMAND 
  251.   281:       _dotprompt,        //  6 Dot prompt string 
  252.   282:       _sqlprompt,        //  7 Sql prompt string 
  253.   283:       _sql_dir,            //  8 Path for SQL system files 
  254.   284:       _sql_database,     //  9 Name of SQL system database 
  255.   285:       _font_file,        // 10 Name of font file 
  256.   286:       _defdrive,            // 11 DBASE default drive
  257.   287:       _disp_period,      // 12 Current display decimal point 
  258.   288:       _disp_comma,       // 13 Current FSE separator 
  259.   289:       _def_period,       // 14 Default display decimal point 
  260.   290:       _def_comma         // 15 Default FSE separator 
  261.   291:  ;
  262.   292:  //
  263.   293:  // Enum for Monitor types
  264.   294:  // Values returned by numset(_flgcolor)
  265.   295:   enum mono   = 0, 
  266.   296:        cga,
  267.   297:        ega25,
  268.   298:        mono43 = 4,
  269.   299:        ega43  = 6
  270.   300:  ;
  271.   301:  //
  272.   302:  // Values returned by Object Class
  273.   303:  //
  274.   304:   enum app    = 1,  // 1) Application object
  275.   305:        popup,       // 2) Popup object
  276.   306:        f_pick,      // 3) File picklist object
  277.   307:        s_pick,      // 4) Fields picklist object
  278.   308:        v_pick,      // 5) Values picklist object
  279.   309:        bar = 7,     // 7) Horizontal Bar object
  280.   310:                     // 6,8 N/A
  281.   311:        btch   = 9   // 9) Batch object
  282.   312:        form     = 11,
  283.   313:        label    = 12,
  284.   314:        report   = 13,
  285.   315:        table_dbf= 20,
  286.   316:        update   = 21,
  287.   317:        query    = 22,
  288.   318:        catalog  = 23  
  289.   319:  ;
  290.   320:  //
  291.   321:  // Values returned Textgetl() or Textgetc() at End of file
  292.   322:  //
  293.   323:  enum eof = -1;
  294.   324:  //
  295.   325:  // Enum string constants for international translation
  296.   326:  //
  297.   327:  enum any_key      = "Press any key ...",
  298.   328:       read_only    = " can't be opened - possible read-only file.  ",
  299.   329:       gen_request  = "Generation request cancelled.  ",
  300.   330:       gen_complete = "Generation is complete.  "
  301.   331:  ;
  302.   332:  //
  303.   333:  // Generic User Defined functions follow
  304.   334:  
  305.   335:  define say_center(mrow, mstring)
  306.   336:     // mrow = Row to put string
  307.   337:     // mstring = Text to display to Row position
  308.   338:     enum width_of_screen = 80;
  309.   339:     var mcol;
  310.   340:     mcol = ( width_of_screen / 2) - ( len( mstring)/2)
  311.   341:     cursor_pos( mrow, mcol )
  312.   342:     cput(mstring)
  313.   343:  enddef
  314.   344:  
  315.   345:  define say(mrow, mcol, mstring)
  316.   346:     // mrow = Row to put string
  317.   347:     // mcol = Column to put string
  318.   348:     // mstring = Text to display to Row position
  319.   349:     cursor_pos( mrow, mcol )
  320.   350:     cput( mstring )
  321.   351:  enddef
  322.   352:  
  323.   353:  define abs(value)
  324.   354:     // Absolute value of a number
  325.   355:     // value = Number to convert to absolute value
  326.   356:     if value < 0 then
  327.   357:       value = val( substr( str( value ), 2))
  328.   358:     endif
  329.   359:     return value;
  330.   360:  enddef
  331.   361:  
  332.   362:  define beep(value)
  333.   363:     // Simulate a bell
  334.   364:     // value = Number of times to beep
  335.   365:     var cnt;
  336.   366:     cnt = 1
  337.   367:     do while cnt <= value
  338.   368:        cput( chr(7) )
  339.   369:        cnt = cnt + 1
  340.   370:     enddo
  341.   371:     return;
  342.   372:  enddef
  343.   373:  
  344.   374:  define cap_first(string)                
  345.   375:     // Takes and returns a string with first letter capped
  346.   376:     return upper( substr( string,1,1)) + lower( substr( string,2))
  347.   377:  enddef
  348.   378:  
  349.   379:  define nul2zero(numbr)
  350.   380:     // if number is nul and we are expecting a zero - convert the nul to 0
  351.   381:     return (numbr ? numbr : 0);
  352.   382:  enddef
  353.   383:  }
  354.   384:     86:  
  355.    87:  // Enum ON KEY labels AND error strings in FORM.DEF
  356.    88:  
  357.    89:  enum  offset = 3,             // Offset for lmarg()
  358.    90:        max_workareas = 8,   // Maximum workareas to leave the files open   
  359.    91:        screen_width = 80;    // Screen width for now
  360.    92:  //
  361.    93:  
  362.    94:  if FRAME_CLASS != form then // We are not processing a form object
  363.    95:    pause(wrong_class + any_key)
  364.    96:    goto NoGen;
  365.    97:  endif
  366.    98:  
  367.    99:  var  fmt_name,     // Format file name
  368.   100:       crlf,         // line feed
  369.   101:       carry_flg,    // Flag to test carry loop
  370.   102:       carry_cnt,    // Count of the number of fields to carry
  371.   103:       carry_len,    // Cumulative length of carry line until 75 characters
  372.   104:       carry_lent,   // Total cumulative length of carry line
  373.   105:       carry_first,  // Flag to test "," output for carry fields
  374.   106:       color_flg,    // Flag to if color should stay on am line
  375.   107:       line_cnt,     // Count for total lines processed (Mulitple page forms)
  376.   108:       page_cnt,     // Count for total pages processed (Mulitple page forms)
  377.   109:       temp,         // tempory work variable
  378.   110:       cnt,          // Foreach loop variable
  379.   111:       wnd_cnt,      // Window counter
  380.   112:       wnd_names,    // Window names so I can clear them at the bottom of the file
  381.   113:       default_drv,  // dBASE default drive
  382.   114:       dB_status,    // dBASE status before entering designer
  383.   115:       scrn_size,    // Screen size when generation starts
  384.   116:       left_delimiter, // Delimiter to put around SAY
  385.   117:       right_delimiter, 
  386.   118:       max_pop_row,  // Maximum row that a popup or shadow can start
  387.   119:       display,      // Type of display screen we are on
  388.   120:       is_extensions,// Form extensions
  389.   121:       is_popup,     // POPUP validation requested
  390.   122:       is_help,      // HELP (context sensitive) requested
  391.   123:       is_recalc,    // RECALC for calculated fields is requested
  392.   124:       is_replace,   // REPLACE lookuped fields into the main file ?
  393.   125:       is_zoom,      // ZOOM to form code is requested
  394.   126:       udf_file,     // UDF file has been created
  395.   127:       hlp_name,     // HELP .dbf name
  396.   128:       trow_positn,  // Temporary variable for row_positn
  397.   129:       tcol_positn,  // Temporary variable for col_positn
  398.   130:       at_pop,       // "POPUP" is in FLD_OK_COND
  399.   131:       temp_key,     // store KEY field
  400.   132:       get_list,     // GET's processed on a page
  401.   133:       workarea_cnt, // Workareas USE'd with gen extensions
  402.   134:       workarea_dbfs,// String with all .dbf's USE'd with gen extensions
  403.   135:       color;        // Color returned from getcolor function
  404.   136:  
  405.   137:   //-----------------------------------------------
  406.   138:   // Assign default values to some of the variables
  407.   139:   //-----------------------------------------------
  408.   140:   carry_flg = carry_first = carry_cnt = carry_len = carry_lent =
  409.   141:   is_popup = is_zoom = is_help = is_recalc = is_replace = udf_file = 
  410.   142:   workarea_cnt = wnd_cnt = line_cnt =  color_flg = cnt = is_extensions =0
  411.   143:  
  412.   144:   crlf = chr(10)
  413.   145:   temp = get_list = workarea_dbfs = ""
  414.   146:   page_cnt = 1
  415.   147:   left_delimiter = right_delimiter = "\""
  416.   148:  
  417.   149:   screen_size()
  418.   150:   //-------------------------------
  419.   151:   // Create Format file
  420.   152:   //-------------------------------
  421.   153:   if !make_program(".fmt") then goto nogen
  422.   154:  
  423.   155:   header()                   // Print Header in the Format file
  424.   156:   fmt_file_init()            // Format file initializtion code
  425.   157:   fmt_file_body()            // @ SAY GET Processing
  426.   158:   fmt_file_exit()            // Format file exit code
  427.   159:   make_pop_code()            // Create the Procedure File for POPUP's if required
  428.   160:   make_replace_code()        // Make procedures for the replace of lookup's
  429.   161:   make_zoom_to_form()        // Make procedures for the zoom system
  430.   162:   make_help_code()           // Make procedures for the help system
  431.   163:   make_recalc_code()         // Make procedures for the calculated fields
  432.   164:   if is_help or is_popup then
  433.   165:      // Make shadow procedures
  434.   166:      make_shadow_proc()
  435.   167:   endif
  436.   168:   if is_extensions then
  437.   169:      // Make other udfs like cut, paste, _key_vars
  438.   170:      make_other_udfs()
  439.   171:   endif
  440.   172:  
  441.   173:   if cnt == 0 then
  442.   174:      pause(form_empty + any_key)
  443.   175:   endif
  444.   176:  
  445.   177:   fileerase( fmt_name + ".fmo")  // Force dBASE to recompile the .fmo
  446.   178:   nogen:
  447.   179:  return 0;
  448.   180:  
  449.   181:  //---------------------------------------
  450.   182:  // Template user defined functions follow
  451.   183:  //---------------------------------------
  452.   184:  
  453.   185:  define fmt_file_init()
  454.   186:  //
  455.   187:  // Format file initialization code
  456.   188:  //
  457.   189:  }
  458.   190:  
  459.   191:  *-- Format file initialization code --------------------------------------------
  460.   192:  
  461.   193:  *-- Some of these PRIVATE variables are created based on CodeGen and may not 
  462.   194:  *-- be used by your particular .fmt file
  463.   195:  PRIVATE lc_talk, lc_cursor, lc_display, lc_status, lc_carry, lc_proc,;
  464.   196:          ln_typeahd
  465.   197:  
  466.   198:  IF SET("TALK") = "ON"
  467.   199:     SET TALK OFF
  468.   200:     lc_talk = "ON"
  469.   201:  ELSE
  470.   202:     lc_talk = "OFF"
  471.   203:  ENDIF
  472.   204:  lc_cursor = SET("CURSOR")
  473.   205:  SET CURSOR ON
  474.   206:  {if at("43", display_type()) then}
  475.   207:  
  476.   208:  *-- This form was created in {display_type()} mode
  477.   209:  lc_display = SET("display")
  478.   210:  // MONO, COLOR, EGA25, EGA43, MONO43
  479.   211:  IF .NOT. "43" $ lc_display                             && In 25 line mode
  480.   212:     IF "EGA" $ lc_display
  481.   213:        *-- If EGA is in lc_display try EGA43
  482.   214:        SET DISPLAY TO EGA43
  483.   215:     ELSE
  484.   216:        *-- Otherwise try MONO43
  485.   217:        SET DISPLAY TO MONO43
  486.   218:     ENDIF
  487.   219:  ENDIF
  488.   220:  {endif}
  489.   221:  
  490.   222:  lc_escape = SET("ESCAPE")
  491.   223:  SET ESCAPE OFF
  492.   224:  lc_status = SET("STATUS")
  493.   225:  *-- SET STATUS was \
  494.   226:  {if dB_status then}
  495.   227:  ON when you went into the Forms Designer.
  496.   228:  IF lc_status = "OFF"
  497.   229:     SET STATUS ON
  498.   230:  {else}
  499.   231:  OFF when you went into the Forms Designer.
  500.   232:  IF lc_status = "ON"
  501.   233:     SET STATUS OFF
  502.   234:  {endif}
  503.   235:  ENDIF
  504.   236:  //-----------------------------------------------------------------------
  505.   237:  // Process fields to build "SET CARRY" and WINDOW commands.
  506.   238:  //-----------------------------------------------------------------------
  507.   239:  {
  508.   240:   foreach FLD_ELEMENT flds
  509.   241:     new_page(flds)
  510.   242:     if FLD_CARRY then carry_flg = 1; ++carry_cnt endif
  511.   243:     if chr(FLD_VALUE_TYPE) == "M" and FLD_MEM_TYP and wnd_cnt < 20 then
  512.   244:        ++wnd_cnt
  513.   245:        wnd_names = wnd_names + "wndow" + wnd_cnt + ",";
  514.   246:  }
  515.   247:  
  516.   248:  *-- Window for memo field {cap_first(FLD_FIELDNAME)}.
  517.   249:  DEFINE WINDOW { Window_Def(flds)}\
  518.   250:  {  endif
  519.   251:   next flds
  520.   252:   print(crlf);
  521.   253:   if carry_flg then
  522.   254:  }
  523.   255:  
  524.   256:  lc_carry = SET("CARRY")
  525.   257:  *-- Fields to carry forward during APPEND.
  526.   258:  SET CARRY TO { Carry_Flds()}
  527.   259:  
  528.   260:  {endif}
  529.   261:  {      if check_for_gen_extensions() then
  530.   262:            is_extensions = 1;
  531.   263:  }
  532.   264:  
  533.   265:  IF TYPE("gc_cut") = "U"
  534.   266:     PRIVATE gc_cut
  535.   267:     gc_cut     = SPACE(254)                  && Global variable for cut and paste
  536.   268:  ENDIF
  537.   269:  lc_proc    = SET("procedure")               && Store procedure file name
  538.   270:  ln_typeahd = SET("typeahead")               && Store "typeahead" setting for _Paste
  539.   271:  lc_design  = SET("design")                  && Store "design" setting 
  540.   272:  
  541.   273:  SET PROCEDURE TO u_{substr(name,1,6)}
  542.   274:  SET TYPEAHEAD TO 255
  543.   275:  SET DESIGN OFF
  544.   276:  
  545.   277:  DO _key_vars                               && Initialize Keyboard variables
  546.   278:  
  547.   279:  IF SET("DBTRAP") = "ON"                    && If dbtrap is on warn user
  548.   280:     DO _dbtrap                              && Put up error box
  549.   281:     KEYBOARD CHR( kn_Esc)                   && Escape out of the form since
  550.   282:  ENDIF                                      &&   UDF's won't run
  551.   283:  {    if workarea_cnt <= max_workareas and is_popup then}
  552.   284:  
  553.   285:  DO S_{lower(substr(name,1,7))}{tabto(40)}&& Open up Lookup Files
  554.   286:  {    endif
  555.   287:    endif  // gen_extensions
  556.   288:    if is_help then}
  557.   289:  
  558.   290:  ON KEY LABEL {on_key_help} \
  559.   291:  DO {"H_" + lower(rtrim(substr(name,1,6)))} WITH VARREAD() && Call Help code
  560.   292:  { else
  561.   293:      if is_extensions then}
  562.   294:  ON KEY LABEL {on_key_help}
  563.   295:  {   endif
  564.   296:    endif
  565.   297:    if is_popup then}
  566.   298:  ON KEY LABEL F2 ?? CHR(7)
  567.   299:  { endif
  568.   300:    if is_recalc then}
  569.   301:  ON KEY LABEL {on_key_recalc} \
  570.   302:  DO {"R_" + lower(rtrim(substr(name,1,6)))} WITH VARREAD() && Call Recalc code
  571.   303:  {else
  572.   304:      if is_extensions then}
  573.   305:  ON KEY LABEL {on_key_recalc}
  574.   306:  {    endif
  575.   307:    endif
  576.   308:    if is_zoom then}
  577.   309:  ON KEY LABEL {on_key_zoom} \
  578.   310:  DO {"Z_" + lower(rtrim(substr(name,1,6)))} WITH VARREAD() && Call Zoom code
  579.   311:  { else
  580.   312:      if is_extensions then}
  581.   313:  ON KEY LABEL {on_key_zoom}
  582.   314:  {   endif
  583.   315:    endif
  584.   316:    if is_extensions then}
  585.   317:  ON KEY LABEL {on_key_cut} DO _Cut
  586.   318:  ON KEY LABEL {on_key_edpaste} DO _Edpaste
  587.   319:  ON KEY LABEL {on_key_paste} DO _Paste
  588.   320:  
  589.   321:  {  endif
  590.   322:     if is_replace then
  591.   323:         make_memvar_declarations()
  592.   324:     endif
  593.   325:  return;
  594.   326:  // eof - fmt_file_init()
  595.   327:  enddef
  596.   328:  
  597.   329:  //--------------------------------------------------------------
  598.   330:  define fmt_file_body()
  599.   331:  }
  600.   332:  
  601.   333:  *-- @ SAY GETS Processing. -----------------------------------------------------
  602.   334:  
  603.   335:  
  604.   336:  *--  Format Page: {page_cnt = 1
  605.   337:                     page_cnt}
  606.   338:   
  607.   339:  {line_cnt = wnd_cnt = 0
  608.   340:   foreach ELEMENT k
  609.   341:     color = getcolor(FLD_DISPLAY, FLD_EDITABLE) // get color of element
  610.   342:     if new_page(k) then
  611.   343:        write_recalc_get_list()
  612.   344:        get_list = "";
  613.   345:  }
  614.   346:  READ
  615.   347:  
  616.   348:  *-- Format Page: {page_cnt}
  617.   349:  
  618.   350:  {  endif
  619.   351:  //
  620.   352:  
  621.   353:     if ELEMENT_TYPE == @TEXT_ELEMENT or ELEMENT_TYPE == @FLD_ELEMENT then
  622.   354:       if FLD_FIELDTYPE == calc then}
  623.   355:  *-- Calculated field: {cap_first(FLD_FIELDNAME)} - {FLD_DESCRIPT}
  624.   356:  {    endif
  625.   357:       if FLD_FIELDTYPE == memvar then}
  626.   358:  *-- Memory variable: {cap_first(FLD_FIELDNAME)}
  627.   359:  {    endif}
  628.   360:  @ {nul2zero(ROW_POSITN) - line_cnt},{nul2zero(COL_POSITN)} \
  629.   361:  {  endif
  630.   362:     if ELEMENT_TYPE == @BOX_ELEMENT then}
  631.   363:  @ {box_coordinates(k)}\
  632.   364:  {  endif}
  633.   365:  //
  634.   366:  {  case ELEMENT_TYPE of
  635.   367:     @TEXT_ELEMENT:
  636.   368:     // Certain control characters can cause dBASE problems ie, ASCII(13,26,0)
  637.   369:     // so the form designer will either send them to us as a string if they are
  638.   370:     // all the same character or as individual characters if they differ. We
  639.   371:     // handle this by using the chr() function to "SAY" them in dBASE.
  640.   372:  }
  641.   373:  SAY \
  642.   374:  {     if asc(TEXT_ITEM) < 32 then
  643.   375:          if len(TEXT_ITEM) == 1 then}
  644.   376:  CHR({asc(TEXT_ITEM)}) \
  645.   377:  {       else}
  646.   378:  REPLICATE(CHR({asc(TEXT_ITEM)}), {len(TEXT_ITEM)}) \
  647.   379:  {       endif
  648.   380:        else
  649.   381:           if substr(TEXT_ITEM,1,1) == "\"" then
  650.   382:              // Double quote is being used on the design surface need to use
  651.   383:              // brackets "[]" as delimiters
  652.   384:              left_delimiter = "["
  653.   385:              right_delimiter = "]"
  654.   386:           endif
  655.   387:           left_delimiter + TEXT_ITEM + right_delimiter} \
  656.   388:  {        left_delimiter = right_delimiter = "\""
  657.   389:        endif
  658.   390:        outcolor()}
  659.   391:  {  @BOX_ELEMENT:
  660.   392:         outbox(BOX_TYPE, BOX_SPECIAL_CHAR)}
  661.   393:  {      outcolor()}
  662.   394:  {  @FLD_ELEMENT:
  663.   395:        if !FLD_EDITABLE then; // its a SAY}
  664.   396:  SAY \
  665.   397:  {        if FLD_FIELDTYPE == calc then
  666.   398:              // Loop thru expression in case it is longer than 237
  667.   399:              foreach FLD_EXPRESSION fcursor in k
  668.   400:                 FLD_EXPRESSION}
  669.   401:  {           next}
  670.   402:  // Output a space after the Fld_expression and get ready for picture clause
  671.   403:   \
  672.   404:  {        else // not a editable field
  673.   405:              if FLD_FIELDTYPE == dbf then temp = "" else temp = "m->" endif
  674.   406:                 temp + cap_first(FLD_FIELDNAME)} \
  675.   407:  {        endif
  676.   408:           if Ok_Template(k) then}
  677.   409:  PICTURE "{picture_for_say(k);}" \
  678.   410:  {        endif
  679.   411:        else // it's a GET}
  680.   412:  GET \
  681.   413:  {        if FLD_FIELDTYPE == dbf then temp = "" else temp = "m->" endif
  682.   414:           get_list = get_list + FLD_FIELDNAME + ","
  683.   415:           temp + cap_first(FLD_FIELDNAME)} \
  684.   416:  {        if chr(FLD_VALUE_TYPE) == "M" && FLD_MEM_TYP && wnd_cnt < 20 then ++wnd_cnt
  685.   417:              if Fld_mem_typ == 1}OPEN {endif}WINDOW wndow{wnd_cnt} \
  686.   418:  {        endif
  687.   419:           if Ok_Template(k) then}
  688.   420:  PICTURE "{picture_for_get(k);}" \
  689.   421:  {        endif
  690.   422:           if FLD_L_BOUND or FLD_U_BOUND then color_flg = 1;}
  691.   423:  ;
  692.   424:     RANGE {FLD_L_BOUND}{if FLD_U_BOUND then},{FLD_U_BOUND}{endif} \
  693.   425:  {        endif
  694.   426:           if FLD_OK_COND then color_flg = 1;}
  695.   427:  ;
  696.   428:  {           if ( at("POPUP", upper(ltrim(FLD_OK_COND))) == "2" and
  697.   429:                   ok_coordinates( k, 2, 1, bad_pick )
  698.   430:                 ) or
  699.   431:                 at("BROWSE", upper(ltrim(FLD_OK_COND))) == "2" then
  700.   432:                 // A POPUP or BROWSE is desired for showing coded values,
  701.   433:                 // redo the VALID clause to call a UDF based on "U_" + FLD_FIELDNAME
  702.   434:  }
  703.   435:     VALID {if is_required(FLD_OK_COND) or 
  704.   436:               upper(getenv("dtl_req")) == "ON" then}REQUIRED {endif}\
  705.   437:  {  get_udfname(FLD_FIELDNAME)}( {cap_first(FLD_FIELDNAME)} ) \
  706.   438:  {              // Allow a user's UDF to follow "BROWSE" OR "POPUP" logic
  707.   439:                 if at(".AND.", upper(FLD_OK_COND)) then
  708.   440:                    substr( FLD_OK_COND, at(".AND.", upper(FLD_OK_COND)))} \
  709.   441:  {              endif
  710.   442:              else
  711.   443:                  if !popup_or_browse(k) then
  712.   444:  }
  713.   445:     VALID {if upper(getenv("dtl_req")) == "ON" then}REQUIRED {endif}{FLD_OK_COND} \
  714.   446:  {
  715.   447:                  endif
  716.   448:              endif
  717.   449:  
  718.   450:              if FLD_REJ_MSG then}
  719.   451:  ;
  720.   452:     ERROR \
  721.   453:  {              if !at("IIF", upper(FLD_REJ_MSG))}"{endif}{FLD_REJ_MSG}\
  722.   454:  {              if !at("IIF", upper(FLD_REJ_MSG))}"{endif} \
  723.   455:  {           endif
  724.   456:           endif // FLD_OK_COND
  725.   457:           if FLD_ED_COND then color_flg = 1;}
  726.   458:  ;
  727.   459:     WHEN {FLD_ED_COND} \
  728.   460:  {
  729.   461:           endif
  730.   462:           if FLD_DEF_VAL then color_flg = 1;}
  731.   463:  ;
  732.   464:     DEFAULT {FLD_DEF_VAL} \
  733.   465:  {        endif
  734.   466:           if FLD_HLP_MSG then color_flg = 1;}
  735.   467:  ;
  736.   468:     MESSAGE \
  737.   469:  {           if !at("IIF", upper(FLD_HLP_MSG))}"{endif}{FLD_HLP_MSG}\
  738.   470:  {           if !at("IIF", upper(FLD_HLP_MSG))}"{endif} \
  739.   471:  {        endif
  740.   472:        endif // FLD_EDITABLE}
  741.   473:  {     outcolor()}
  742.   474:  {     color_flg = 0;
  743.   475:     otherwise: goto getnext;
  744.   476:     endcase
  745.   477:  }
  746.   478:  
  747.   479:  //Leave the above blank line, it forces a line feed!
  748.   480:  //-----------------
  749.   481:  // End of @ SAY GET
  750.   482:  //-----------------
  751.   483:  {  ++cnt;
  752.   484:     getnext:
  753.   485:   next k;
  754.   486:   write_recalc_get_list()  // Write last line of recalc list
  755.   487:  return;
  756.   488:  // eof - fmt_file_body()
  757.   489:  enddef
  758.   490:  
  759.   491:  //--------------------------------------------------------------
  760.   492:  define fmt_file_exit()
  761.   493:  }
  762.   494:  
  763.   495:  *-- Format file exit code -----------------------------------------------------
  764.   496:  
  765.   497:  {if is_extensions then}
  766.   498:  *-- Get rid of the ON KEY set above
  767.   499:  {  if is_help then}
  768.   500:  ON KEY LABEL {on_key_help}
  769.   501:  {  endif}
  770.   502:  ON KEY LABEL F2
  771.   503:  {  if is_recalc then}
  772.   504:  ON KEY LABEL {on_key_recalc}
  773.   505:  {  endif}
  774.   506:  ON KEY LABEL {on_key_cut}
  775.   507:  ON KEY LABEL {on_key_edpaste}
  776.   508:  ON KEY LABEL {on_key_paste}
  777.   509:  {  if is_zoom then}
  778.   510:  ON KEY LABEL {on_key_zoom}
  779.   511:  {  endif
  780.   512:       if workarea_cnt <= max_workareas and is_popup then}
  781.   513:  
  782.   514:  DO C_{lower(substr(name,1,7))}{tabto(40)}&& Close up Lookup Files
  783.   515:  {    endif}
  784.   516:  
  785.   517:  SET PROCEDURE TO (lc_proc)
  786.   518:  SET TYPEAHEAD TO (ln_typeahd)
  787.   519:  SET DESIGN &lc_design.
  788.   520:  {endif}
  789.   521:  
  790.   522:  *-- SET STATUS was \
  791.   523:  {if dB_status then}
  792.   524:  ON when you went into the Forms Designer.
  793.   525:  IF lc_status = "OFF"  && Entered form with status off
  794.   526:     SET STATUS OFF     && Turn STATUS "OFF" on the way out
  795.   527:  {else}
  796.   528:  OFF when you went into the Forms Designer.
  797.   529:  IF lc_status = "ON"  && Entered form with status on
  798.   530:     SET STATUS ON     && Turn STATUS "ON" on the way out
  799.   531:  {endif}
  800.   532:  ENDIF
  801.   533:  {if carry_flg then}
  802.   534:  
  803.   535:  SET CARRY &lc_carry.
  804.   536:  {endif}
  805.   537:  SET CURSOR &lc_cursor.
  806.   538:  {if at("43", display_type()) then}
  807.   539:  SET DISPLAY TO &lc_display.      && Reset Screen size if changed
  808.   540:  {endif}
  809.   541:  SET ESCAPE &lc_escape.
  810.   542:  SET TALK &lc_talk.
  811.   543:  
  812.   544:  {if wnd_names then}
  813.   545:  RELEASE WINDOWS {substr(wnd_names, 1, (len(wnd_names) - 1))}
  814.   546:  {endif
  815.   547:   if is_extensions then}
  816.   548:  
  817.   549:  RELEASE ALL LIKE kn_*
  818.   550:  RELEASE ALL LIKE rn_*
  819.   551:  {endif}
  820.   552:  *-- EOP: {filename(fmt_name)}FMT
  821.   553:  {return;
  822.   554:  // eof - fmt_file_exit()
  823.   555:  enddef
  824.   556:  
  825.   557:  //--------------------------------------------------------------
  826.   558:  define header()
  827.   559:      // Print Header in program
  828.   560:      print( replicate( "*",80) + crlf);}
  829.   561:  *-- Name.......: {filename(fmt_name)}FMT
  830.   562:  *-- Date.......: {ltrim( substr( date(),1,8))}
  831.   563:  *-- Version....: dBASE IV, Format {FRAME_VER}.1
  832.   564:  *-- Notes......: Format files use "" as delimiters!
  833.   565:  {   print( replicate( "*",80) + crlf);
  834.   566:  enddef
  835.   567:  
  836.   568:  //---------------------------------------------------------------------------
  837.   569:  // Standard FORM extension routines
  838.   570:  include "ccb_fext.cod"
  839.     1:  {
  840.     2:  // Module Name: FORM_EXT.COD
  841.     3:  // Description: This module produces PROCEDURES & FUNCTIONS
  842.     4:  //              used in form processing (for FORM.COD)
  843.     5:  //
  844.     6:  //----Modified 6/9/91 by Barry Fox, Fox Computer Consulting to allow
  845.     7:  //    help support generation to proceed if database name is different
  846.     8:  //    from form name.  Will prompt user for database name to check for
  847.     9:  //    existance of help dbf if no help dbf is found corresponding to 
  848.    10:  //    form name.
  849.    11:  //
  850.    12:  define screen_size()
  851.    13:     // Test screen size if display > 2 screen is 43 lines
  852.    14:     display = numset(_flgcolor)
  853.    15:     if display > ega25 then
  854.    16:         scrn_size = 39
  855.    17:         max_pop_row = 36
  856.    18:     else
  857.    19:         scrn_size = 21
  858.    20:         max_pop_row = 18
  859.    21:     endif
  860.    22:  
  861.    23:     // Test to see if status was off before going into form designer
  862.    24:     dB_status = numset(_flgstatus)
  863.    25:     if scrn_size == 21 and !db_status then
  864.    26:        scrn_size = 24
  865.    27:        max_pop_row = 21
  866.    28:     endif
  867.    29:     if scrn_size == 39 and !db_status then // status is off
  868.    30:        scrn_size = 42
  869.    31:        max_pop_row = 39
  870.    32:     endif
  871.    33:     return;
  872.    34:  enddef
  873.    35:  
  874.    36:  //--------------------------------------------------------------
  875.    37:  define display_type()
  876.    38:      // Find out the display type we are working on
  877.    39:      var temp;
  878.    40:      case display of
  879.    41:         mono:   temp = "MONO"
  880.    42:         cga:    temp = "COLOR"
  881.    43:         ega25:  temp = "EGA25"
  882.    44:         mono43: temp = "MONO43"
  883.    45:         ega43:  temp = "EGA43"
  884.    46:       endcase
  885.    47:       return temp;
  886.    48:  enddef
  887.    49:  
  888.    50:  //--------------------------------------------------------------
  889.    51:  define getcolor(f_display,         // Color of the current field
  890.    52:                  f_editable         // Field is SAY or GET
  891.    53:                 )
  892.    54:   // Determines the color from f_display and f_editable (GET or SAY)
  893.    55:   enum  Foreground  =   7,
  894.    56:         Intensity   =   8,  // Color
  895.    57:         Background  = 112,
  896.    58:         MIntensity  = 256,
  897.    59:         Reverse     = 512,  // Mono
  898.    60:         Underline   =1024,
  899.    61:         Blink       =2048,
  900.    62:         default     =32768; // Screen set to default
  901.    63:  
  902.    64:   var forgrnd, enhanced, backgrnd, blnk, underln, revrse, use_colors, incolor;
  903.    65:   incolor=""
  904.    66:  
  905.    67:   use_colors  = default & f_display
  906.    68:   forgrnd  = Foreground & f_display
  907.    69:   enhanced = (Intensity & f_display) || (MIntensity & f_display)
  908.    70:   backgrnd = Background & f_display
  909.    71:   blnk     = Blink  & f_display
  910.    72:   underln  = Underline & f_display
  911.    73:   revrse   = Reverse & f_display
  912.    74:  
  913.    75:   if not use_colors then // Use system colors, no colors set in designer
  914.    76:  
  915.    77:      if backgrnd then backgrnd = backgrnd/16 endif
  916.    78:  
  917.    79:      if (display != mono and display != mono43) then
  918.    80:         case forgrnd of
  919.    81:          0: incolor = "n"
  920.    82:          1: incolor = "b"
  921.    83:          2: incolor = "g"
  922.    84:          3: incolor = "bg"
  923.    85:          4: incolor = "r"
  924.    86:          5: incolor = "rb"
  925.    87:          6: incolor = "gr"
  926.    88:          7: incolor = "w"
  927.    89:         endcase
  928.    90:      else
  929.    91:         incolor = "w"
  930.    92:      endif
  931.    93:  
  932.    94:      if revrse then
  933.    95:         incolor = incolor + "i"
  934.    96:      endif
  935.    97:      if underln then
  936.    98:         incolor = incolor + "u"
  937.    99:      endif
  938.   100:      if enhanced then
  939.   101:         incolor = incolor + "+"
  940.   102:      endif
  941.   103:      if blnk then
  942.   104:         incolor = incolor + "*"
  943.   105:      endif
  944.   106:  
  945.   107:      incolor = incolor + "/"
  946.   108:  
  947.   109:      if (display != mono and display != mono43) then
  948.   110:         case backgrnd of
  949.   111:          0: incolor = incolor + "n"
  950.   112:          1: incolor = incolor + "b"
  951.   113:          2: incolor = incolor + "g"
  952.   114:          3: incolor = incolor + "bg"
  953.   115:          4: incolor = incolor + "r"
  954.   116:          5: incolor = incolor + "rb"
  955.   117:          6: incolor = incolor + "gr"
  956.   118:          7: incolor = incolor + "w"
  957.   119:         endcase
  958.   120:      else
  959.   121:         incolor = incolor + "n"
  960.   122:      endif
  961.   123:  
  962.   124:      if f_editable and incolor then
  963.   125:         incolor = incolor + "," + incolor
  964.   126:      endif
  965.   127:  
  966.   128:   endif // use no colors
  967.   129:   return alltrim(incolor);
  968.   130:  enddef
  969.   131:  
  970.   132:  //--------------------------------------------------------------
  971.   133:  define outbox(mbox,            // Border type
  972.   134:                mchar            // Special character of border
  973.   135:               )
  974.   136:     // Output the of Box border and character if any
  975.   137:     var result;
  976.   138:     case mbox of
  977.   139:        0: result = " " // single
  978.   140:        1: result = " DOUBLE "
  979.   141:        2: result = " CHR("+mchar+") "
  980.   142:     endcase
  981.   143:     return result;
  982.   144:  enddef
  983.   145:  
  984.   146:  //--------------------------------------------------------------
  985.   147:  define outcolor()
  986.   148:    // Output the of color of the @ SAY GET or Box
  987.   149:    var result;
  988.   150:    result = "";
  989.   151:    if len(color) > 0 then
  990.   152:       if color_flg then
  991.   153:          // If flag is set output a dBASE continuation ";"
  992.   154:          result = ";" + crlf + space(3)
  993.   155:       endif
  994.   156:       result = result + "COLOR " + color + " "
  995.   157:    endif
  996.   158:    return result;
  997.   159:  enddef
  998.   160:  
  999.   161:  //--------------------------------------------------------------
  1000.   162:  define window_def(cur)                  // Pass in foreach cursor
  1001.   163:     // Build dBASE window command
  1002.   164:     var result;
  1003.   165:     result = "wndow" + wnd_cnt + " FROM " + Box_Coordinates(cur)
  1004.   166:     result = result + outbox(cur.BOX_TYPE, cur.BOX_SPECIAL_CHAR)
  1005.   167:     color = getcolor(cur.FLD_DISPLAY, cur.FLD_EDITABLE)
  1006.   168:     result = result + outcolor()
  1007.   169:     return result;
  1008.   170:  enddef
  1009.   171:  
  1010.   172:  //--------------------------------------------------------------
  1011.   173:  define box_coordinates(cur)             // Pass in foreach cursor
  1012.   174:     // Build box coordinates for a dBASE window command
  1013.   175:     var result, temp_page, line_cnt;
  1014.   176:     temp_page = page_cnt;
  1015.   177:  
  1016.   178:     // Adjust box coordinates so that negative numbers are not generated
  1017.   179:     do while ( nul2zero(cur.BOX_TOP) - (scrn_size * temp_page) ) <= 1
  1018.   180:        temp_page = temp_page - 1
  1019.   181:     enddo
  1020.   182:     //-- Adjust "temp_page" for page 1 and 2
  1021.   183:     if page_cnt == 1 then
  1022.   184:        temp_page = 0
  1023.   185:     endif
  1024.   186:     if page_cnt == 2 then
  1025.   187:        temp_page = 1
  1026.   188:     endif
  1027.   189:     //-------------------------
  1028.   190:  
  1029.   191:     if !temp_page then
  1030.   192:        line_cnt = 0
  1031.   193:     else
  1032.   194:        line_cnt = (scrn_size * temp_page) + (1 * temp_page)
  1033.   195:     endif
  1034.   196:  
  1035.   197:     result = nul2zero(cur.BOX_TOP) - line_cnt +","
  1036.   198:     result = result + nul2zero(cur.BOX_LEFT) + " TO "
  1037.   199:     temp = nul2zero(cur.BOX_TOP) + cur.BOX_HEIGHT - line_cnt - 1
  1038.   200:     if temp > scrn_size then temp = scrn_size endif
  1039.   201:     result = result + temp + "," + (nul2zero(cur.BOX_LEFT) + cur.BOX_WIDTH - 1)
  1040.   202:     return result;
  1041.   203:  enddef
  1042.   204:  
  1043.   205:  //--------------------------------------------------------------
  1044.   206:  define carry_flds()
  1045.   207:     // Build dBASE SET CARRY command
  1046.   208:     carry_len = carry_lent = 13
  1047.   209:     carry_first = 0
  1048.   210:     foreach FLD_ELEMENT flds
  1049.   211:        if FLD_CARRY then
  1050.   212:           carry_len = carry_len + len(FLD_FIELDNAME + ",")
  1051.   213:           carry_lent = carry_lent + len(FLD_FIELDNAME + ",")
  1052.   214:           if carry_lent > 1000 then
  1053.   215:              print(crlf + "SET CARRY TO ")
  1054.   216:              carry_len = carry_lent = 13
  1055.   217:           endif
  1056.   218:           if carry_len > 75 then 
  1057.   219:             print(";" + crlf + "  ")  
  1058.   220:             carry_len = 2 
  1059.   221:           endif
  1060.   222:           temp = cap_first(FLD_FIELDNAME)
  1061.   223:           if !carry_first then
  1062.   224:              print(temp)
  1063.   225:              carry_first = 1
  1064.   226:           else
  1065.   227:              print("," + temp)
  1066.   228:           endif
  1067.   229:        endif
  1068.   230:      next flds
  1069.   231:      print(" ADDITIVE");
  1070.   232:   return
  1071.   233:  enddef
  1072.   234:  
  1073.   235:  //--------------------------------------------------------------
  1074.   236:  define picture_for_get(c)
  1075.   237:       if c.FLD_PICFUN then}@{c.FLD_PICFUN}\
  1076.   238:  {       if at("S", c.FLD_PICFUN) then}{c.FLD_PIC_SCROLL}{endif}\
  1077.   239:   {//leave this space}\
  1078.   240:  {    endif
  1079.   241:       if at("M", c.FLD_PICFUN) then
  1080.   242:          c.FLD_PIC_CHOICE}\
  1081.   243:  {    else
  1082.   244:          c.FLD_TEMPLATE}\
  1083.   245:  {    endif
  1084.   246:   return;
  1085.   247:  enddef
  1086.   248:  
  1087.   249:  //--------------------------------------------------------------
  1088.   250:  define picture_for_say(c)
  1089.   251:       if c.FLD_PICFUN then}@{c.FLD_PICFUN}\
  1090.   252:  {       if at("S", c.FLD_PICFUN) then}{c.FLD_PIC_SCROLL}{endif}\
  1091.   253:   {//leave this space}\
  1092.   254:  {       endif
  1093.   255:       if !at("M", c.FLD_PICFUN) then
  1094.   256:          c.FLD_TEMPLATE}\
  1095.   257:  {    endif
  1096.   258:   return;
  1097.   259:  enddef
  1098.   260:  
  1099.   261:  //--------------------------------------------------------------
  1100.   262:  define ok_template(cur)                 // Pass in foreach cursor
  1101.   263:       if cur.FLD_TEMPLATE && !(chr(cur.FLD_VALUE_TYPE) == "D" ||
  1102.   264:                                chr(cur.FLD_VALUE_TYPE) == "M") then
  1103.   265:          return 1;
  1104.   266:       else
  1105.   267:          return 0;
  1106.   268:       endif
  1107.   269:  enddef
  1108.   270:  //--------------------------------------------------------------
  1109.   271:  define ok_coordinates(cur,              // Current cursor
  1110.   272:                        xtra_width,       // Additional width to check ie, shadow
  1111.   273:                        want_message,     // Display message flag 0:No 1:Yes
  1112.   274:                        message)          // Message to display to user
  1113.   275:       // Check to see if coordinates of popup or shadow will fit on screen
  1114.   276:       // based on the dimensions of the current field
  1115.   277:       if nul2zero(cur.COL_POSITN) + len(cur.FLD_TEMPLATE) + xtra_width > screen_width then
  1116.   278:          if want_message then
  1117.   279:             beep(2)                      // UDF in builtin.def
  1118.   280:             cls()
  1119.   281:             say_center(10,"Error on Field: " + cur.FLD_FIELDNAME)
  1120.   282:             say_center(12, message)
  1121.   283:             pause(any_key)
  1122.   284:          endif
  1123.   285:          return 0;
  1124.   286:       else
  1125.   287:          return 1;
  1126.   288:       endif
  1127.   289:  enddef
  1128.   290:  
  1129.   291:  //--------------------------------------------------------------
  1130.   292:  define make_program(ext)
  1131.   293:     // Attempt to create program (fmt) file.
  1132.   294:     ext = upper( ext)
  1133.   295:     default_drv = strset(_defdrive)  // grab default drive from dBASE
  1134.   296:     fmt_name = FRAME_PATH + NAME     // Put path on to object name
  1135.   297:     if not fileok(fmt_name) then
  1136.   298:        if not default_drv then
  1137.   299:           fmt_name = NAME
  1138.   300:        else
  1139.   301:           fmt_name = default_drv + ":" + NAME
  1140.   302:        endif
  1141.   303:     endif
  1142.   304:     fmt_name = upper(fmt_name)
  1143.   305:     if not create(fmt_name + ext) then
  1144.   306:          pause(fileroot(fmt_name) + ext + read_only + any_key)
  1145.   307:          return 0;
  1146.   308:       endif
  1147.   309:     return 1;
  1148.   310:  enddef
  1149.   311:  
  1150.   312:  //--------------------------------------------------------------
  1151.   313:  define make_udf()
  1152.   314:     // Attempt to create dBASE procedure (prg) file.
  1153.   315:     var udf_root_file_name;
  1154.   316:     udf_root_file_name =  frame_path + "u_" + rtrim(substr(name,1,6))
  1155.   317:     if not create( udf_root_file_name + ".PRG") then
  1156.   318:        pause(udf_root_file_name + ".PRG" + read_only + any_key)
  1157.   319:        return 0;
  1158.   320:     endif
  1159.   321:     // Force dBASE to recompile the .prg
  1160.   322:     fileerase(udf_root_file_name + ".DBO")
  1161.   323:     udf_file = 1 // Global flag to determine if UDF file was created
  1162.   324:     return 1;
  1163.   325:  enddef
  1164.   326:  
  1165.   327:  //--------------------------------------------------------------
  1166.   328:  define udf_header()
  1167.   329:      // Print Header in UDF program
  1168.   330:      print("*"+replicate("-",78)+crlf);}
  1169.   331:  *-- Name....: {frame_path}u_{rtrim(substr(name,1,6))}.PRG
  1170.   332:  *-- Date....: {ltrim(SUBSTR(date(),1,8))}
  1171.   333:  *-- Version.: dBASE IV, Procedures for Format (.fmt) v{Frame_ver}.1
  1172.   334:  *-- Notes...: Procedure file for VALID POPUPs and/or Context Sensitive Help
  1173.   335:  *-- ........: for {filename(fmt_name)}FMT
  1174.   336:  {print("*"+replicate("-",78)+crlf);
  1175.   337:  enddef
  1176.   338:  
  1177.   339:  //--------------------------------------------------------------
  1178.   340:  define make_pop_code()
  1179.   341:       var lookup_dbf,  // store get_file(FLD_OK_COND) for faster processing
  1180.   342:           is_format,   // is there a format file
  1181.   343:           temp_name,   // store get_popname(FLD_OK_COND) for faster processing
  1182.   344:           ;
  1183.   345:           //              temp_key;    // store KEY field
  1184.   346:  
  1185.   347:  //   Create the Procedure File for POPUP's if required
  1186.   348:       if is_popup then
  1187.   349:  //          if !at("FORMBROW", upper(getenv("dtl_form"))) then
  1188.   350:               if !make_udf() then
  1189.   351:                    return 0;
  1190.   352:                endif
  1191.   353:              udf_header()
  1192.   354:  //          endif
  1193.   355:            if workarea_cnt <= max_workareas then
  1194.   356:  }
  1195.   357:  PROCEDURE S_{lower(substr(name,1,7))}{tabto(40)}&& Open Lookup files for faster processing
  1196.   358:  {           foreach FLD_ELEMENT flds
  1197.   359:                   if popup_or_browse(flds) then
  1198.   360:                      lookup_dbf = get_file(FLD_OK_COND)
  1199.   361:                      if not at(lookup_dbf, workarea_dbfs) then
  1200.   362:                         workarea_dbfs = workarea_dbfs + "," + lookup_dbf;
  1201.   363:  }
  1202.   364:    USE {lookup_dbf} ORDER {get_key(FLD_OK_COND)} IN SELECT() \
  1203.   365:  {                      if (upper(lookup_dbf) == FLD_FILENAME) then}
  1204.   366:  AGAIN ALIAS {"A"+substr(lookup_dbf,1,7)}
  1205.   367:  {                      else}
  1206.   368:   {//leave this space}
  1207.   369:  {                      endif
  1208.   370:                      endif
  1209.   371:                   endif
  1210.   372:              next flds;
  1211.   373:  }
  1212.   374:  RETURN
  1213.   375:  *-- EOP: S_{lower(substr(name,1,7))}
  1214.   376:  
  1215.   377:  PROCEDURE C_{lower(substr(name,1,7))}{tabto(40)}&& Close Lookup files
  1216.   378:  {           workarea_dbfs = ""
  1217.   379:              foreach FLD_ELEMENT flds
  1218.   380:                   if popup_or_browse(flds) then
  1219.   381:                      lookup_dbf = get_file(FLD_OK_COND);
  1220.   382:                      if not at(lookup_dbf, workarea_dbfs) then
  1221.   383:                         workarea_dbfs = workarea_dbfs + "," + lookup_dbf;
  1222.   384:  }
  1223.   385:    USE IN ALIAS("{ upper(lookup_dbf) == FLD_FILENAME ? "A"+substr(lookup_dbf,1,7) : lookup_dbf }")
  1224.   386:  {                   endif
  1225.   387:                   endif
  1226.   388:              next flds;
  1227.   389:            endif
  1228.   390:  }
  1229.   391:  RETURN
  1230.   392:  *-- EOP: C_{lower(substr(name,1,7))}
  1231.   393:  
  1232.   394:  FUNCTION Empty                       && Determine if the passed argument is NULL
  1233.   395:  {lmarg(offset)}
  1234.   396:  PARAMETER x
  1235.   397:  PRIVATE retval, lc_type
  1236.   398:  lc_type = TYPE("x")
  1237.   399:  DO CASE
  1238.   400:    CASE lc_type = "C"
  1239.   401:      retval = (LEN(TRIM(x))=0)
  1240.   402:    CASE lc_type$"NF"
  1241.   403:      retval = (x=0)
  1242.   404:    CASE lc_type = "D"
  1243.   405:      retval = (" "$DTOC(x))
  1244.   406:    OTHERWISE lc_type = "U"
  1245.   407:      retval = .T.
  1246.   408:  ENDCASE
  1247.   409:  {lmarg(0)}
  1248.   410:  RETURN (retval)
  1249.   411:  *-- EOP: _Empty
  1250.   412:  
  1251.   413:  {print("*"+replicate("-",78)+crlf);}
  1252.   414:  PROCEDURE _DbfEmpty
  1253.   415:     *-- Error box if Lookup .dbf is empty
  1254.   416:     *-- Save the screen and setup window
  1255.   417:     PRIVATE ALL LIKE l?_*
  1256.   418:     DEFINE WINDOW u_error FROM 5,15 TO 11,55
  1257.   419:     SAVE SCREEN TO u_error
  1258.   420:     DO _Shadowg WITH 5,15,11,55
  1259.   421:  
  1260.   422:     *-- Activate the window and put up error message
  1261.   423:     ACTIVATE WINDOW u_error
  1262.   424:     lc_fpath = SET("fullpath")
  1263.   425:     SET FULLPATH OFF
  1264.   426:     @ 1,2 SAY "Lookup table: " + SUBSTR( DBF(),3) + " is empty!"
  1265.   427:     @ 2,2 SAY "{any_key}"
  1266.   428:     ln_errorky = INKEY(10)
  1267.   429:  
  1268.   430:     *-- Restore the screen and clean up
  1269.   431:     SET FULLPATH &lc_fpath.
  1270.   432:     RELEASE WINDOW u_error
  1271.   433:     RESTORE SCREEN FROM u_error
  1272.   434:     RELEASE SCREEN u_error
  1273.   435:  RETURN
  1274.   436:  *-- EOP: _DbfEmpty
  1275.   437:  
  1276.   438:  {
  1277.   439:            line_cnt = 0
  1278.   440:            page_cnt = 1
  1279.   441:  
  1280.   442:            foreach FLD_ELEMENT flds
  1281.   443:  
  1282.   444:                 at_pop = at("POPUP", upper(ltrim(FLD_OK_COND))) == "2" ? 1 : 0;
  1283.   445:  
  1284.   446:                 new_page(flds)
  1285.   447:                 if popup_or_browse(flds) then
  1286.   448:                      trow_positn = nul2zero(ROW_POSITN) - line_cnt
  1287.   449:                      tcol_positn = nul2zero(COL_POSITN)
  1288.   450:                      color = getcolor(FLD_DISPLAY, FLD_EDITABLE) // get color of element
  1289.   451:  
  1290.   452:                      if at_pop and !ok_coordinates(flds, 2, 0, "") then loop endif
  1291.   453:  
  1292.   454:                      print("*"+replicate("-",78)+crlf);
  1293.   455:  }
  1294.   456:  FUNCTION {get_udfname(FLD_FIELDNAME)}
  1295.   457:  {lmarg(offset)}
  1296.   458:  PARAMETER fld_name
  1297.   459:  PRIVATE ALL LIKE l?_*
  1298.   460:  PRIVATE fld_name, rtn_fld
  1299.   461:  
  1300.   462:  ll_return = .T.                      && Declare return variable for function
  1301.   463:  ln_row = ROW()                       && Current Row of Get
  1302.   464:  ln_col = COL()                       && Current Column of Get
  1303.   465:  rtn_fld = fld_name                   && Current Value of Get
  1304.   466:  
  1305.   467:  {                   if !is_required(FLD_OK_COND) then}
  1306.   468:  IF EMPTY(fld_name)                   && Not a required field
  1307.   469:    RETURN (.T.)                       && if null field
  1308.   470:  ENDIF
  1309.   471:  
  1310.   472:  {                    endif
  1311.   473:                       if is_help then}
  1312.   474:  
  1313.   475:  ON KEY LABEL {on_key_help}
  1314.   476:  {                    endif
  1315.   477:                       if is_recalc then}
  1316.   478:  ON KEY LABEL {on_key_recalc}
  1317.   479:  {                    endif
  1318.   480:                       if is_zoom then}
  1319.   481:  ON KEY LABEL {on_key_zoom}
  1320.   482:  {                    endif}
  1321.   483:  
  1322.   484:  lc_alias = ALIAS()                   && Grab current workarea
  1323.   485:  //--------------------------------------------------------------------------
  1324.   486:  // kjn New design for Edit/Browse that will eliminate the @ GET code
  1325.   487:  // Will allow this code to go away
  1326.   488:  //--------------------------------------------------------------------------
  1327.   489:  
  1328.   490:  IF ln_row = {row_positn} .AND. (ln_col >= {col_positn} .AND. ln_col <= {col_positn+FLD_LENGTH+6} )
  1329.   491:     ll_edit = .T.
  1330.   492:  ELSE
  1331.   493:     ll_edit = .F.
  1332.   494:  ENDIF
  1333.   495:  
  1334.   496:  {                   lookup_dbf = get_file(FLD_OK_COND);
  1335.   497:                      temp_key = alltrim(get_key(FLD_OK_COND));
  1336.   498:  
  1337.   499:                      if workarea_cnt <= max_workareas then
  1338.   500:  }
  1339.   501:  SELECT ("{ upper(lookup_dbf) == FLD_FILENAME ? "A"+substr(lookup_dbf,1,7) : 
  1340.   502:                                                 lookup_dbf }")
  1341.   503:  {                   else}
  1342.   504:  SELECT SELECT()
  1343.   505:  IF FILE("{lookup_dbf}.dbf")
  1344.   506:     USE {lookup_dbf} ORDER {temp_key} \
  1345.   507:  {                     if (upper(lookup_dbf) == FLD_FILENAME) then}
  1346.   508:  AGAIN
  1347.   509:  {                     else}
  1348.   510:   {//leave this space}
  1349.   511:  {                     endif}
  1350.   512:  ELSE
  1351.   513:     SET MESSAGE TO "{lookup_dbf}.dbf {use_err}  {any_key}"
  1352.   514:     ll_wait = INKEY(0)
  1353.   515:     SET MESSAGE TO
  1354.   516:     RETURN .F.
  1355.   517:  ENDIF
  1356.   518:  {                   endif  // workarea_cnt}
  1357.   519:  
  1358.   520:  lc_exact = SET("EXACT")              && Store value of EXACT
  1359.   521:  SET EXACT ON
  1360.   522:  {                   if !at_pop then}
  1361.   523:  lc_near =  SET("NEAR")               && Store value of NEAR
  1362.   524:  SET NEAR ON                          && Do "soft" seek into "BROWSE"
  1363.   525:  
  1364.   526:  {                   endif
  1365.   527:                      if chr(FLD_VALUE_TYPE) == "C" then}
  1366.   528:  fld_name = IIF( EMPTY( TRIM( fld_name)), fld_name, TRIM( fld_name))
  1367.   529:  {                   endif}
  1368.   530:  SEEK fld_name
  1369.   531:  
  1370.   532:  SET EXACT &lc_exact.                 && Restore SET EXACT to org. value
  1371.   533:  {                   if !at_pop then}
  1372.   534:  SET NEAR  &lc_near.                  && Restore SET NEAR  to org. value
  1373.   535:  {                   endif}
  1374.   536:  
  1375.   537:  IF .NOT. FOUND()
  1376.   538:  
  1377.   539:  {                   temp_name = get_popname(FLD_OK_COND);
  1378.   540:  
  1379.   541:                      if at_pop then  // Gen for Popup lookup}
  1380.   542:     DEFINE POPUP {temp_name} FROM \
  1381.   543:  {                      if trow_positn < max_pop_row then
  1382.   544:                            trow_positn + 1},{tcol_positn} ;
  1383.   545:      TO {scrn_size-1},{tcol_positn + len(FLD_TEMPLATE) + 1} ;
  1384.   546:  {                      else
  1385.   547:                             trow_positn - 11},{tcol_positn} ;
  1386.   548:      TO {trow_positn - 1},{tcol_positn + len(FLD_TEMPLATE) + 1} ;
  1387.   549:  {                      endif}
  1388.   550:      PROMPT FIELD {get_field(FLD_OK_COND)} ;
  1389.   551:      MESSAGE {select_msg1}
  1390.   552:  
  1391.   553:     ON SELECTION POPUP {temp_name} DEACTIVATE POPUP
  1392.   554:  
  1393.   555:  {                      if chr(FLD_VALUE_TYPE) == "C" then}
  1394.   556:     KEYBOARD TRIM( fld_name ) CLEAR
  1395.   557:  
  1396.   558:  {                      endif
  1397.   559:                      else
  1398.   560:                         // Gen for BROWSE lookup
  1399.   561:                         if (is_update(FLD_OK_COND) and is_fields(FLD_OK_COND)) then
  1400.   562:                         // If updateable and fields declared then check for no records
  1401.   563:  }
  1402.   564:  //  Currently BLOWS dbase UP kjn
  1403.   565:  //
  1404.   566:  //   IF RECCOUNT() = 0
  1405.   567:  //      APPEND BLANK
  1406.   568:  //      REPLACE {cap_first(FLD_FIELDNAME)} WITH \
  1407.   569:  //{            cap_first(FLD_FILENAME)}->{cap_first(FLD_FIELDNAME)}
  1408.   570:  //      KEYBOARD( CHR( kn_Tab)) CLEAR
  1409.   571:  //   ENDIF
  1410.   572:  //{                      else}
  1411.   573:     IF RECCOUNT() = 0
  1412.   574:        DO _DbfEmpty
  1413.   575:        ll_return = .F.
  1414.   576:     ENDIF
  1415.   577:  
  1416.   578:     IF ll_return
  1417.   579:  
  1418.   580:  {                         lmarg(offset*2)
  1419.   581:                         endif}
  1420.   582:     DEFINE WINDOW {temp_name} FROM \
  1421.   583:  {                      if is_window(FLD_OK_COND) then
  1422.   584:                            get_browse_window(flds)
  1423.   585:                         else
  1424.   586:                            print("14,0 TO 20,79")
  1425.   587:                         endif
  1426.   588:  }
  1427.   589:  
  1428.   590:  {                   endif}
  1429.   591:     SAVE SCREEN TO {temp_name}
  1430.   592:  
  1431.   593:  {                   if is_shadow(FLD_OK_COND) then
  1432.   594:                         if at_pop and ok_coordinates( flds, 4, 1, bad_shadow ) then
  1433.   595:  }
  1434.   596:     DO _Shadowg WITH {get_pop_shadow(FLD_TEMPLATE);}
  1435.   597:  {                      endif
  1436.   598:                         if !at_pop then}
  1437.   599:     DO _Shadowg WITH \
  1438.   600:  {                         if is_window(FLD_OK_COND) then
  1439.   601:                               get_browse_shadow(FLD_OK_COND)
  1440.   602:                            else
  1441.   603:                               print("14,0,20,77")
  1442.   604:                            endif
  1443.   605:                         endif
  1444.   606:                      endif
  1445.   607:                      if at_pop then}
  1446.   608:     ACTIVATE POPUP {temp_name}
  1447.   609:  
  1448.   610:     rtn_fld = PROMPT()               && Get user choice from Picklist
  1449.   611:  
  1450.   612:     RELEASE POPUP {temp_name}
  1451.   613:  {                   else}
  1452.   614:  
  1453.   615:     lc_message = {select_msg1} +;
  1454.   616:                  {select_msg2}
  1455.   617:  
  1456.   618:     lc_message = IIF("500" $ VERSION(1), ;
  1457.   619:                   LEFT( lc_message, LEN( lc_message) - 17) , lc_message)
  1458.   620:     SET MESSAGE TO lc_message
  1459.   621:  
  1460.   622:     ON KEY LABEL Ctrl-M KEYBOARD( CHR( kn_CtrlEnd)) CLEAR   && Same as Enter send Ctrl-W
  1461.   623:  
  1462.   624:  {                   is_format = is_format_file(flds, FLD_OK_COND);
  1463.   625:                      if is_format then}
  1464.   626:     IF FILE("{fileroot( get_format_file( FLD_OK_COND)) + ".FMT"}")
  1465.   627:        SET FORMAT TO {fileroot( get_format_file(FLD_OK_COND))}
  1466.   628:     ENDIF
  1467.   629:  
  1468.   630:  {                   endif}
  1469.   631:     IF .NOT. "500" $ VERSION(1)
  1470.   632:        ON KEY LABEL {on_key_move} DO _MoveWind WITH WINDOW(), lc_message
  1471.   633:     ENDIF
  1472.   634:  
  1473.   635:     BROWSE WINDOW {temp_name} NOMENU COMPRESS NOFOLLOW NODELETE LOCK 1 \
  1474.   636:  {                   if ( !is_update(FLD_OK_COND) or
  1475.   637:                           !is_fields(FLD_OK_COND) or
  1476.   638:                           ( upper(lookup_dbf) == FLD_FILENAME )
  1477.   639:                         ) then}
  1478.   640:  ;
  1479.   641:        NOAPPEND NOEDIT \
  1480.   642:  {                   endif
  1481.   643:                      if is_format then}
  1482.   644:  ;
  1483.   645:        FORMAT \
  1484.   646:  {                   endif
  1485.   647:                      if is_fields(FLD_OK_COND) then}
  1486.   648:  ;
  1487.   649:        FIELDS {get_browse_fields_list(flds)} \
  1488.   650:  //                                             outputs correct line spacing
  1489.   651:  {                   endif}
  1490.   652:  
  1491.   653:  
  1492.   654:  //  Currently BLOWS dbase UP kjn
  1493.   655:  //{                   if is_update(FLD_OK_COND) then}
  1494.   656:  //   IF EMPTY({cap_first(get_field(FLD_OK_COND))}) .AND. RECCOUNT() = 1
  1495.   657:  //      lc_safety = SET("SAFETY")
  1496.   658:  //      SET SAFETY OFF
  1497.   659:  //      ZAP
  1498.   660:  //      SET SAFETY &lc_safety.
  1499.   661:  //   ENDIF
  1500.   662:  //
  1501.   663:  //{                   endif}
  1502.   664:  {                   if is_format then}
  1503.   665:     SET FORMAT TO
  1504.   666:  {                   endif}
  1505.   667:     ON KEY LABEL {on_key_move}
  1506.   668:     ON KEY LABEL Ctrl-M
  1507.   669:     SET MESSAGE TO
  1508.   670:  
  1509.   671:     RELEASE WINDOW {temp_name}
  1510.   672:  {                   endif}
  1511.   673:  
  1512.   674:     RESTORE SCREEN FROM {temp_name}
  1513.   675:  
  1514.   676:  {//  for code that blows up above kjn
  1515.   677:   //                   if !(is_update(FLD_OK_COND) and is_fields(FLD_OK_COND)) then
  1516.   678:                         // Need ENDIF for IF ll_return above
  1517.   679:  
  1518.   680:                        if (is_update(FLD_OK_COND) and is_fields(FLD_OK_COND)) then
  1519.   681:                        // for now gen endif for this, kjn.  if append works
  1520.   682:                        // delete this if and uncomment out the one right above
  1521.   683:                         lmarg(offset)
  1522.   684:  }
  1523.   685:     ENDIF
  1524.   686:  {                   endif}
  1525.   687:  
  1526.   688:     IF LASTKEY() <> kn_esc
  1527.   689:  {                   if !at_pop then}
  1528.   690:       rtn_fld = {cap_first(get_field(FLD_OK_COND))}
  1529.   691:  {                   endif}
  1530.   692:  {                   if is_required(FLD_OK_COND) then}
  1531.   693:  
  1532.   694:       IF EMPTY(rtn_fld)             && Is a required field, so return .F.
  1533.   695:          ll_return = .F.
  1534.   696:       ELSE
  1535.   697:  {                      lmarg(offset * 2)
  1536.   698:                      endif}
  1537.   699:  
  1538.   700:  //--------------------------------------------------------------------------
  1539.   701:  // kjn New design for Edit/Browse that will eliminate the @ GET code
  1540.   702:  // Will allow this code to go away
  1541.   703:  //--------------------------------------------------------------------------
  1542.   704:       IF ll_edit
  1543.   705:          @ {trow_positn},{tcol_positn} GET rtn_fld \
  1544.   706:  {        if Ok_Template(flds) then}
  1545.   707:  PICTURE "{picture_for_get(flds);}" \
  1546.   708:  {           outcolor()}
  1547.   709:  {        endif}
  1548.   710:  
  1549.   711:       ENDIF
  1550.   712:  //--------------------------------------------------------------------------
  1551.   713:  
  1552.   714:       REPLACE {cap_first(FLD_FILENAME)}->{cap_first(FLD_FIELDNAME)} WITH \
  1553.   715:  {                   if chr(FLD_VALUE_TYPE) == "C" or
  1554.   716:                         at("BROWSE", upper(ltrim(FLD_OK_COND))) == "2" then}
  1555.   717:  rtn_fld
  1556.   718:  {                   else}
  1557.   719:  VAL(rtn_fld)
  1558.   720:  {                   endif}
  1559.   721:  
  1560.   722:       ll_return = .T.
  1561.   723:  {                   if is_required(FLD_OK_COND) then
  1562.   724:                         lmarg(offset)}
  1563.   725:       ENDIF
  1564.   726:  {                   endif}
  1565.   727:     ELSE
  1566.   728:       ll_return = .F.
  1567.   729:  {
  1568.   730:                      if !is_required(FLD_OK_COND) then
  1569.   731:  }
  1570.   732:  
  1571.   733:       IF EMPTY(fld_name)             && Not a required field, so return .t.
  1572.   734:          ll_return = .T.
  1573.   735:       ENDIF
  1574.   736:  
  1575.   737:  {                   endif}
  1576.   738:     ENDIF
  1577.   739:  
  1578.   740:  ELSE
  1579.   741:    ll_return = .T.
  1580.   742:  ENDIF
  1581.   743:  {if is_replace(FLD_OK_COND) then}
  1582.   744:  
  1583.   745:  IF ll_return
  1584.   746:     DO U_{lower(substr(FLD_FIELDNAME,1,7))} WITH ll_edit, \
  1585.   747:  {                   if chr(FLD_VALUE_TYPE) == "C" or
  1586.   748:                         at("BROWSE", upper(ltrim(FLD_OK_COND))) == "2" then}
  1587.   749:  rtn_fld
  1588.   750:  {                   else}
  1589.   751:  VAL(rtn_fld)
  1590.   752:  {                   endif}
  1591.   753:  ENDIF
  1592.   754:  {endif}
  1593.   755:  
  1594.   756:  {if workarea_cnt > max_workareas then}
  1595.   757:  USE
  1596.   758:  
  1597.   759:  {endif}
  1598.   760:  SELECT (lc_alias)                    && Go back to the edit file
  1599.   761:  
  1600.   762:  {if is_help then}
  1601.   763:  ON KEY LABEL {on_key_help} \
  1602.   764:  DO {"H_" + lower(rtrim(substr(name,1,6)))} WITH VARREAD() && Call Help code
  1603.   765:  {endif
  1604.   766:   if is_recalc then}
  1605.   767:  ON KEY LABEL {on_key_recalc} \
  1606.   768:  DO {"R_" + lower(rtrim(substr(name,1,6)))} WITH VARREAD() && Call Recalc code
  1607.   769:  {endif
  1608.   770:   if is_zoom then}
  1609.   771:  ON KEY LABEL {on_key_zoom} \
  1610.   772:  DO {"Z_" + lower(rtrim(substr(name,1,6)))} WITH VARREAD() && Call Zoom code
  1611.   773:  {endif
  1612.   774:   lmarg(0)}
  1613.   775:  RETURN (ll_return)
  1614.   776:  *-- EOP: {get_udfname(FLD_FIELDNAME)}
  1615.   777:  
  1616.   778:  {              endif
  1617.   779:            next flds
  1618.   780:        endif   // there were POPUP VALID clauses
  1619.   781:  
  1620.   782:       return;
  1621.   783:  // eof - make_pop_code()
  1622.   784:  enddef
  1623.   785:  
  1624.   786:  //--------------------------------------------------------------
  1625.   787:  define make_shadow_proc()
  1626.   788:       // Make the dBASE code for shadowing
  1627.   789:       print("*"+replicate("-",78)+crlf);
  1628.   790:  }
  1629.   791:  PROCEDURE _Shadowg                      && displays shadow that grows
  1630.   792:  {    lmarg(offset)}
  1631.   793:  PARAMETER x1,y1,x2,y2
  1632.   794:  PRIVATE   x1,y1,x2,y2
  1633.   795:  
  1634.   796:  x0 = x2+1
  1635.   797:  y0 = y2+2
  1636.   798:  dx = 1
  1637.   799:  dy = (y2-y1) / (x2-x1)
  1638.   800:  DO WHILE x0 <> x1 .OR. y0 <> y1+2
  1639.   801:    @ x0,y0 FILL TO x2+1,y2+2 COLOR n+/n
  1640.   802:    x0 = IIF(x0<>x1,x0 - dx,x0)
  1641.   803:    y0 = IIF(y0<>y1+2,y0 - dy,y0)
  1642.   804:    y0 = IIF(y0<y1+2,y1+2,y0)
  1643.   805:  ENDDO
  1644.   806:  {    lmarg(0)}
  1645.   807:  RETURN
  1646.   808:  *-- EOP: _Shadowg
  1647.   809:  
  1648.   810:  {print("*"+replicate("-",78)+crlf);}
  1649.   811:  PROCEDURE _dbtrap                             && error routine for SET("dbtrap")
  1650.   812:  {    var wcol1, wcol2, error_msg_length;
  1651.   813:        error_msg_length = len( dbtrap_err)
  1652.   814:        wcol1 = (screen_width/2) - ( error_msg_length/2) - 2
  1653.   815:        wcol2 = (screen_width/2) + ( error_msg_length/2) + 2
  1654.   816:       lmarg(offset);
  1655.   817:  }
  1656.   818:  SET CURSOR OFF
  1657.   819:  PRIVATE ALL LIKE l?_*
  1658.   820:  SAVE SCREEN TO _dbtrap
  1659.   821:  DO _Shadowg WITH 10, {wcol1}, 15, {wcol2}
  1660.   822:  DEFINE WINDOW _dbtrap FROM 10,{wcol1} TO 15,{wcol2} DOUBLE
  1661.   823:  ACTIVATE WINDOW _dbtrap
  1662.   824:  lc_error = "{dbtrap_err}"
  1663.   825:  lc_error2 = "{any_key}"
  1664.   826:  @ 1, CENTER( lc_error,  {wcol2 - wcol1}) SAY lc_error
  1665.   827:  @ 2, CENTER( lc_error2, {wcol2 - wcol1}) SAY lc_error2
  1666.   828:  lc_wait = INKEY(10)
  1667.   829:  RELEASE WINDOW _dbtrap
  1668.   830:  RESTORE SCREEN FROM _dbtrap
  1669.   831:  RELEASE SCREEN _dbtrap
  1670.   832:  SET CURSOR ON
  1671.   833:  {    lmarg(0)}
  1672.   834:  RETURN
  1673.   835:  *-- EOP: _dbtrap
  1674.   836:  {    return;
  1675.   837:  enddef // make_shadow_proc()
  1676.   838:  
  1677.   839:  //--------------------------------------------------------------
  1678.   840:  define make_help_code()
  1679.   841:       //------------------------------------
  1680.   842:       // Make procedures for the help system
  1681.   843:       // called from form.gen
  1682.   844:       //------------------------------------
  1683.   845:        if is_help then
  1684.   846:           // If the udf file has not already been created, make it.
  1685.   847:          if !udf_file then
  1686.   848:             if !make_udf() then
  1687.   849:                return 0;
  1688.   850:             endif
  1689.   851:             // Put up the UDF header
  1690.   852:             udf_header()
  1691.   853:          endif
  1692.   854:          // Make procedures for the help system
  1693.   855:          make_help()
  1694.   856:        endif
  1695.   857:  return;
  1696.   858:  enddef
  1697.   859:  
  1698.   860:  //--------------------------------------------------------------
  1699.   861:  define make_help()
  1700.   862:     // Make the dBASE code for help
  1701.   863:     var help_name;
  1702.   864:     help_name = "H_" + lower(rtrim(substr(name,1,6)))
  1703.   865:     print("*"+replicate("-",78)+crlf);
  1704.   866:  }
  1705.   867:  
  1706.   868:  PROCEDURE {help_name}
  1707.   869:  {    lmarg(offset)}
  1708.   870:  *-- Activates the HELP window
  1709.   871:  PARAMETER lc_var
  1710.   872:  PRIVATE ALL LIKE l?_*
  1711.   873:  IF .NOT. FILE("{fileroot(hlp_name)}.dbf")
  1712.   874:     *-- Help file has been deleted or can't be found
  1713.   875:     RETURN
  1714.   876:  ENDIF
  1715.   877:  
  1716.   878:  SET CURSOR OFF
  1717.   879:  ON KEY LABEL {on_key_help}
  1718.   880:  
  1719.   881:  *-- Select workarea and open Help dbf
  1720.   882:  lc_area = ALIAS()
  1721.   883:  SELECT SELECT()
  1722.   884:  USE {fileroot(hlp_name)} ORDER fld_name NOUPDATE   && Open HELP .dbf
  1723.   885:  
  1724.   886:  lc_exact = SET("EXACT")                && Store value of EXACT
  1725.   887:  SET EXACT ON
  1726.   888:  SEEK lc_var
  1727.   889:  SET EXACT &lc_exact.
  1728.   890:  
  1729.   891:  IF FOUND()                             && If found show Help
  1730.   892:    ln_t = 5
  1731.   893:    ln_l = 6
  1732.   894:    ln_b = 15
  1733.   895:    ln_r = 74
  1734.   896:    DEFINE WINDOW {lower(help_name)} FROM ln_t+1, ln_l+2 TO ln_b-1, ln_r-2 NONE
  1735.   897:    ON ERROR lc_error = error()
  1736.   898:    SAVE SCREEN TO {lower(help_name)}
  1737.   899:  
  1738.   900:    *-- Make Help Box
  1739.   901:    DO _Shadowg WITH ln_t, ln_l, ln_b, ln_r
  1740.   902:    @ ln_t+1, ln_l+1 CLEAR TO ln_b-1, ln_r-1
  1741.   903:    @ ln_t, ln_l TO ln_b, ln_r DOUBLE
  1742.   904:  
  1743.   905:    ln_memline = SET("MEMO")
  1744.   906:    SET MEMOWIDTH TO 65
  1745.   907:    IF MEMLINES(fld_help) > 9
  1746.   908:      @ ln_t+1,ln_r SAY CHR(24)
  1747.   909:      @ ln_b-1,ln_r SAY CHR(25)
  1748.   910:      SET CURSOR ON
  1749.   911:    ENDIF
  1750.   912:    lc_string = CHR(185)+ [ Help for ] + TRIM(fld_headng) +[ ] + CHR(204)
  1751.   913:    lc_message = IIF( MEMLINES(fld_help) > 9 , ;
  1752.   914:                      "{help_msg1}" , ;
  1753.   915:                      "" ;
  1754.   916:  //                    "{help_msg1 + help_msg2}" , ;
  1755.   917:  //                    "{help_msg2}" ;
  1756.   918:                    )
  1757.   919:  
  1758.   920:    @ ln_t,CENTER(lc_string,80) SAY lc_string
  1759.   921:    @ 0,0 GET fld_help OPEN WINDOW {lower(help_name)} MESSAGE lc_message
  1760.   922:  //  ON KEY LABEL {on_key_toggle} DO _Toggle
  1761.   923:  //  ON KEY LABEL {on_key_move} DO _MoveWind WITH WINDOW(), lc_message
  1762.   924:    READ
  1763.   925:    SET MEMOWIDTH TO ln_memline
  1764.   926:    ON ERROR
  1765.   927:  //  ON KEY LABEL {on_key_toggle}
  1766.   928:  //  ON KEY LABEL {on_key_move}
  1767.   929:    RELEASE WINDOW {lower(help_name)}
  1768.   930:    RESTORE SCREEN FROM {lower(help_name)}
  1769.   931:    RELEASE SCREEN {lower(help_name)}
  1770.   932:  ENDIF
  1771.   933:  SET MESSAGE TO
  1772.   934:  SET CURSOR ON
  1773.   935:  USE                                              && Close help file
  1774.   936:  SELECT (lc_area)                                 && Back to edit work area
  1775.   937:  ON KEY LABEL {on_key_help} DO {help_name} WITH VARREAD()
  1776.   938:  {    lmarg(0)}
  1777.   939:  RETURN
  1778.   940:  *-- EOP: {help_name}
  1779.   941:  
  1780.   942:  //{    print("*"+replicate("-",78)+crlf);}
  1781.   943:  //PROCEDURE _Toggle
  1782.   944:  //{    lmarg(offset)}
  1783.   945:  //PRIVATE ln_wait
  1784.   946:  //*-- Toggles the Help message back to the original screen
  1785.   947:  //SAVE SCREEN TO Toggle
  1786.   948:  //RESTORE SCREEN FROM {lower(help_name)}
  1787.   949:  //{    if (scrn_size == 24 or scrn_size == 42) then}
  1788.   950:  //@ {scrn_size}, 0
  1789.   951:  //@ {scrn_size}, CENTER("{any_key}", {screen_width}) SAY "{any_key}"
  1790.   952:  //{    else}
  1791.   953:  //SET MESSAGE TO "{any_key}"
  1792.   954:  //{    endif}
  1793.   955:  //ln_wait = INKEY(15)
  1794.   956:  //RESTORE SCREEN FROM Toggle
  1795.   957:  //RELEASE SCREEN Toggle
  1796.   958:  //SET MESSAGE TO lc_message
  1797.   959:  //{    lmarg(0)}
  1798.   960:  //RETURN
  1799.   961:  //*-- EOP: _Toggle
  1800.   962:  //
  1801.   963:  {return;
  1802.   964:  enddef
  1803.   965:  
  1804.   966:  //--------------------------------------------------------------
  1805.   967:  define make_other_udfs()
  1806.   968:      // Make other UDF's used durning form processing
  1807.   969:      print(crlf + "*"+replicate("-",78)+crlf);
  1808.   970:  }
  1809.   971:  PROCEDURE _Cut
  1810.   972:  {    lmarg(offset)}
  1811.   973:  *-- Cut data from a field
  1812.   974:  PRIVATE ALL LIKE l?_*
  1813.   975:  
  1814.   976:  lc_field = VARREAD()
  1815.   977:  lc_type = TYPE( lc_field)
  1816.   978:  SAVE SCREEN TO _cut
  1817.   979:  
  1818.   980:  DO CASE
  1819.   981:  CASE lc_type = "C"
  1820.   982:      gc_cut = TRIM( &lc_field.)
  1821.   983:  CASE lc_type $ "NF"
  1822.   984:      ln_cnt = 0
  1823.   985:      ln_number = &lc_field.
  1824.   986:      DO WHILE _numdec( ln_number)
  1825.   987:         ln_number = ln_number * 10
  1826.   988:         ln_cnt = ln_cnt + 1
  1827.   989:      ENDDO
  1828.   990:      gc_cut = LTRIM( STR( &lc_field., 14, ln_cnt))
  1829.   991:  CASE lc_type = "D"
  1830.   992:      gc_cut = DTOC( &lc_field.)
  1831.   993:  CASE lc_type = "L"
  1832.   994:      gc_cut = IIF( &lc_field., "Y", "F")
  1833.   995:  CASE lc_type = "M"
  1834.   996:      gc_cut = SUBSTR( &lc_field., 1, 254)
  1835.   997:      ln_len = LEN( TRIM( gc_cut))
  1836.   998:      ln_cnt = 1
  1837.   999:  
  1838.  1000:      DO WHILE ln_cnt <= ln_len
  1839.  1001:         *-- Get rid of MODI COMM's soft carriage returns characters
  1840.  1002:         IF ASC( SUBSTR( gc_cut, ln_cnt, 1)) = 141 .OR.;
  1841.  1003:            ASC( SUBSTR( gc_cut, ln_cnt, 1)) =  10 .OR.;
  1842.  1004:            ASC( SUBSTR( gc_cut, ln_cnt, 1)) =  13
  1843.  1005:  
  1844.  1006:            IF ASC( SUBSTR( gc_cut, ln_cnt, 1)) =  13
  1845.  1007:               gc_cut = STUFF( gc_cut, ln_cnt, 1, " ")
  1846.  1008:            ELSE
  1847.  1009:               gc_cut = STUFF( gc_cut, ln_cnt, 1, "")
  1848.  1010:            ENDIF
  1849.  1011:  
  1850.  1012:            ln_len = LEN( TRIM( gc_cut))             && Length of string can change
  1851.  1013:            LOOP
  1852.  1014:         ENDIF
  1853.  1015:         ln_cnt = ln_cnt + 1
  1854.  1016:        ENDDO
  1855.  1017:  ENDCASE
  1856.  1018:  
  1857.  1019:  lc_message = SUBSTR( gc_cut, 1, {(screen_width - 1) - len(paste_msg1)}) + "{paste_msg1}"
  1858.  1020:  {    if (scrn_size == 24 or scrn_size == 42) then}
  1859.  1021:  @ {scrn_size}, CENTER(lc_message, {screen_width}) SAY lc_message
  1860.  1022:  {    else}
  1861.  1023:  SET MESSAGE TO lc_message
  1862.  1024:  {    endif}
  1863.  1025:  ln_key = INKEY(2.5)
  1864.  1026:  gc_cut = gc_cut + SPACE( 254 - LEN( gc_cut))
  1865.  1027:  SET MESSAGE TO
  1866.  1028:  RESTORE SCREEN FROM _cut
  1867.  1029:  RELEASE SCREEN _cut
  1868.  1030:  {    lmarg(0)}
  1869.  1031:  RETURN
  1870.  1032:  
  1871.  1033:  {    print("*"+replicate("-",78)+crlf);}
  1872.  1034:  PROCEDURE _Paste
  1873.  1035:  {    lmarg(offset)}
  1874.  1036:  *-- Cut data to a field
  1875.  1037:  PRIVATE ALL LIKE l?_*
  1876.  1038:  
  1877.  1039:  lc_field = VARREAD()                               && Grab field we left from
  1878.  1040:  lc_type = TYPE( lc_field)                          && Grab the data type
  1879.  1041:  lc_cut = TRIM( gc_cut)                             && Trim blanks from cut data
  1880.  1042:  
  1881.  1043:  IF lc_type = "D"
  1882.  1044:      *-- Remove "/" from character data so that KEYBOARD will work on a
  1883.  1045:      *-- date field
  1884.  1046:  //  KJN "/" -> set("sepa")
  1885.  1047:      lc_cut = STUFF(lc_cut, AT("/", lc_cut), 1, "") && Get rid of first  "/"
  1886.  1048:      lc_cut = STUFF(lc_cut, AT("/", lc_cut), 1, "") && Get rid of second "/"
  1887.  1049:  ENDIF
  1888.  1050:  *-- Keyboard cut data into the field
  1889.  1051:  DO CASE
  1890.  1052:     CASE lc_type $ "NFD"
  1891.  1053:        *-- Start at the beginning of the field and clear it.
  1892.  1054:        KEYBOARD ( CHR(kn_home) + CHR(kn_CtrlY) + lc_cut) CLEAR
  1893.  1055:     CASE lc_type <> "M"
  1894.  1056:        *-- Paste at the location of the cursor
  1895.  1057:        KEYBOARD (lc_cut) CLEAR
  1896.  1058:     OTHERWISE
  1897.  1059:        IF LEN( &lc_field.) > 0
  1898.  1060:           *-- Pad space to offset "scrap" from end of memo
  1899.  1061:           lc_cut = " " + lc_cut
  1900.  1062:        ENDIF
  1901.  1063:        REPLACE &lc_field. WITH lc_cut ADDITIVE         && Replace into memo field
  1902.  1064:        ln_keyboard = CHR(kn_ctrlhme) + CHR(kn_ctrlpdn) + ;
  1903.  1065:                      CHR(kn_space) + CHR(kn_bakspce)   && Makes EDIT think data has changed
  1904.  1066:        KEYBOARD (ln_keyboard) CLEAR                    && Move to bottom of memo
  1905.  1067:  ENDCASE
  1906.  1068:  {    lmarg(0)}
  1907.  1069:  RETURN
  1908.  1070:  
  1909.  1071:  {    print("*"+replicate("-",78)+crlf);}
  1910.  1072:  PROCEDURE _Edpaste
  1911.  1073:  {    lmarg(offset)}
  1912.  1074:  *-- Edit Cut data
  1913.  1075:  PRIVATE ALL LIKE l?_*
  1914.  1076:  
  1915.  1077:  lc_deli = SET("DELIMITERS")
  1916.  1078:  lc_form = SET("FORMAT")
  1917.  1079:  SET DELIMITERS OFF
  1918.  1080:  SET FORMAT TO
  1919.  1081:  SAVE SCREEN TO _edpaste
  1920.  1082:  DEFINE WINDOW _edpaste FROM \
  1921.  1083:  {    if !(scrn_size == 24 or scrn_size == 42) then
  1922.  1084:          scrn_size-2},0 TO {scrn_size},79
  1923.  1085:  {    else
  1924.  1086:          scrn_size-3},0 TO {scrn_size-1},79
  1925.  1087:  {    endif}
  1926.  1088:  
  1927.  1089:  lc_message = "{paste_msg2}"
  1928.  1090:  lc_message = IIF("500" $ VERSION(1), ;
  1929.  1091:                   LEFT( lc_message, LEN( lc_message) - 17) , lc_message)
  1930.  1092:  IF .NOT. "500" $ VERSION(1)
  1931.  1093:     ON KEY LABEL {on_key_move} DO _MoveWind WITH WINDOW(), lc_message
  1932.  1094:  ENDIF
  1933.  1095:  ACTIVATE WINDOW _edpaste
  1934.  1096:  SET MESSAGE TO lc_message
  1935.  1097:  @ 0,0 GET gc_cut PICTURE "@S78"
  1936.  1098:  READ
  1937.  1099:  ON KEY LABEL {on_key_move}
  1938.  1100:  SET MESSAGE TO
  1939.  1101:  RELEASE WINDOW _edpaste
  1940.  1102:  RESTORE SCREEN FROM _edpaste
  1941.  1103:  RELEASE SCREEN _edpaste
  1942.  1104:  SET DELIMITERS &lc_deli.
  1943.  1105:  SET FORM TO (lc_form)
  1944.  1106:  {    lmarg(0)}
  1945.  1107:  RETURN
  1946.  1108:  
  1947.  1109:  {    print("*"+replicate("-",78)+crlf);}
  1948.  1110:  PROCEDURE _MoveWind
  1949.  1111:  PARAMETER wind_name, message
  1950.  1112:  {    lmarg(offset)}
  1951.  1113:  *----------------------------------------------------------
  1952.  1114:  *- Move the &wind_name. window based on arrow keys.  Any 
  1953.  1115:  *- other key stops the move process.
  1954.  1116:  *----------------------------------------------------------
  1955.  1117:  ON KEY LABEL {on_key_move}
  1956.  1118:  ON ERROR ?? CHR(7)
  1957.  1119:  SET MESSAGE TO
  1958.  1120:  DO WHILE .T.
  1959.  1121:    SET MESSAGE TO {wind_msg1}
  1960.  1122:    ln_keyhit = INKEY(0)
  1961.  1123:    IF ln_keyhit <> 0
  1962.  1124:      DO CASE
  1963.  1125:        CASE ln_keyhit = kn_RghtArw               && Right arrow
  1964.  1126:           MOVE WINDOW &wind_name. BY 0,1
  1965.  1127:        CASE ln_keyhit = kn_UpArw                 && Up arrow
  1966.  1128:           MOVE WINDOW &wind_name. BY -1,0
  1967.  1129:        CASE ln_keyhit = kn_LeftArw               && Left arrow
  1968.  1130:           MOVE WINDOW &wind_name. BY 0,-1
  1969.  1131:        CASE ln_keyhit = kn_DownArw               && Down Arrow
  1970.  1132:           MOVE WINDOW &wind_name. BY 1,0
  1971.  1133:        OTHERWISE
  1972.  1134:           EXIT
  1973.  1135:      ENDCASE
  1974.  1136:    ENDIF
  1975.  1137:  ENDDO
  1976.  1138:  ON ERROR
  1977.  1139:  ON KEY LABEL {on_key_move} DO _MoveWind WITH WINDOW(), "&message."
  1978.  1140:  SET MESSAGE TO message
  1979.  1141:  {    lmarg(0)}
  1980.  1142:  RETURN
  1981.  1143:  *-- EOP: _MoveWind
  1982.  1144:  
  1983.  1145:  {    print("*"+replicate("-",78)+crlf);}
  1984.  1146:  FUNCTION _numdec
  1985.  1147:  PARAMETER ln_dec
  1986.  1148:  IF ln_dec - INT(ln_dec) > 0
  1987.  1149:     RETURN .T.
  1988.  1150:  ELSE
  1989.  1151:     RETURN .F.
  1990.  1152:  ENDIF
  1991.  1153:  *-- EOF: _numdec
  1992.  1154:  
  1993.  1155:  {    print("*"+replicate("-",78)+crlf);}
  1994.  1156:  FUNCTION Center
  1995.  1157:  *-- UDF to center a string.
  1996.  1158:  *-- lc_string = String to center
  1997.  1159:  *-- ln_width = Width of screen to center in
  1998.  1160:  *--
  1999.  1161:  *-- Ex. @ 15,center(string,80) say string
  2000.  1162:  *-- Will center the <string> withing 80 columns
  2001.  1163:  PARAMETER lc_string, ln_width
  2002.  1164:  RETURN ((ln_width/2)-(LEN(lc_string)/2))
  2003.  1165:  *-- EOP: Center()
  2004.  1166:  
  2005.  1167:  {print("*"+replicate("-",78)+crlf);}
  2006.  1168:  PROCEDURE _key_vars
  2007.  1169:  *----------------------------------------------------------------------------
  2008.  1170:  * Enumerate the key values for LASTKEY() and INKEY() functions
  2009.  1171:  *
  2010.  1172:  * To check for the Escape key after the INKEY()
  2011.  1173:  * 
  2012.  1174:  *   ln_key = INKEY(0)   && Wait for any key press
  2013.  1175:  *   IF ln_key = kn_Esc  && Escape was pressed
  2014.  1176:  *     DO esc_hand
  2015.  1177:  *   ENDIF
  2016.  1178:  *
  2017.  1179:  *----------------------------------------------------------------------------
  2018.  1180:  IF TYPE("kn_end") = "U"
  2019.  1181:  {lmarg(offset)}
  2020.  1182:  PUBLIC kn_End     , kn_Tab     , kn_Enter   , kn_CtrlEnd , kn_CtrlY   , ;
  2021.  1183:         kn_Home    , kn_Esc     , kn_CtrlHme , kn_CtrlPDn , kn_CtrlPUp , ;
  2022.  1184:         kn_Space   , kn_BakSpce , kn_RghtArw , kn_UpArw   , kn_LeftArw , ;
  2023.  1185:         kn_DownArw , kn_PgDn    , kn_PgUp    , kn_F1      , kn_Del     , ;
  2024.  1186:         kn_CtrLArw , kn_CtrRArw , kn_f7      , kn_ShftF7
  2025.  1187:  
  2026.  1188:    kn_End     =   2      && Ctrl-B
  2027.  1189:    kn_Tab     =   9      && Ctrl-I
  2028.  1190:    kn_Enter   =  13      && Ctrl-M
  2029.  1191:    kn_CtrlEnd =  23      && Ctrl-W
  2030.  1192:    kn_CtrlY   =  25
  2031.  1193:    kn_Home    =  26      && Ctrl-Z
  2032.  1194:    kn_Esc     =  27      && Ctrl-[
  2033.  1195:    kn_CtrlHme =  29      && Ctrl-]
  2034.  1196:    kn_CtrlPDn =  30      && Ctrl-PgDn
  2035.  1197:    kn_CtrlPUp =  31      && Ctrl-PgUp
  2036.  1198:    kn_Space   =  32
  2037.  1199:    kn_BakSpce = 127
  2038.  1200:    kn_RghtArw =   4      && Ctrl-D
  2039.  1201:    kn_UpArw   =   5      && Ctrl-E
  2040.  1202:    kn_LeftArw =  19      && Ctrl-S
  2041.  1203:    kn_DownArw =  24      && Ctrl-X
  2042.  1204:    kn_PgDn    =   3      && Ctrl-C
  2043.  1205:    kn_PgUp    =  18      && Ctrl-R
  2044.  1206:    kn_F1      =  28      && Ctrl-\
  2045.  1207:    kn_Del     =   7      && Ctrl-G
  2046.  1208:    kn_CtrLArw =   1      && Ctrl-A
  2047.  1209:    kn_CtrRArw =   6      && Ctrl-F
  2048.  1210:    kn_F7      =  -6
  2049.  1211:    kn_ShftF7   = -26
  2050.  1212:  
  2051.  1213:  *----------------------------------------------------------------------------
  2052.  1214:  * Enumerate the key values for READKEY()
  2053.  1215:  *
  2054.  1216:  * To check to see if data has changed
  2055.  1217:  *
  2056.  1218:  *   IF READKEY() >= rn_updated   && Data has changed
  2057.  1219:  *     REPLACE name WITH m->name
  2058.  1220:  *   ENDIF
  2059.  1221:  *
  2060.  1222:  * To check for page down regardless of data change
  2061.  1223:  *
  2062.  1224:  *   ln_readkey = READKEY()
  2063.  1225:  *   IF ln_readkey = rn_PgDn .OR. ln_readkey = rn_PgDn+rn_Updated
  2064.  1226:  *     DO pgdn_hand
  2065.  1227:  *   ENDIF
  2066.  1228:  *
  2067.  1229:  *----------------------------------------------------------------------------
  2068.  1230:  PUBLIC rn_Updated , rn_LeftArw , rn_BakSpce , rn_RghtArw , rn_CtrLArw , ;
  2069.  1231:         rn_CtrRArw , rn_UpArw   , rn_DownArw , rn_PgUp    , rn_PgDn    , ;
  2070.  1232:         rn_Esc     , rn_CtrlEnd , rn_Enter   , rn_EnterA  , rn_CtrlHme , ;
  2071.  1233:         rn_CtrlPUp , rn_CtrlPDn , rn_F1
  2072.  1234:  
  2073.  1235:    rn_Updated = 256      && Add to rn_key value for updated condition
  2074.  1236:    rn_LeftArw =   0      && Includes Ctrl-S and Ctrl-H - backward one character
  2075.  1237:    rn_BakSpce =   0      && backward one character                                   
  2076.  1238:    rn_RghtArw =   1      && Includes Ctrl-D and Ctrl-L - forward one character
  2077.  1239:    rn_CtrLArw =   2      && Ctrl-Left Arrow, includes Ctrl-A - previous word
  2078.  1240:    rn_CtrRArw =   3      && Ctrl-Right Arrow, includes Ctrl-F - next word
  2079.  1241:    rn_UpArw   =   4      && Includes Ctrl-E and Ctrl-K - backward one field
  2080.  1242:    rn_DownArw =   5      && Includes Ctrl-J and Ctrl-X - forward one field
  2081.  1243:    rn_PgUp    =   6      && Includes Ctrl-R - backward one screen
  2082.  1244:    rn_PgDn    =   7      && Includes Ctrl-C - forward one screen
  2083.  1245:    rn_Esc     =  12      && Includes Ctrl-Q - Terminate w/o save
  2084.  1246:    rn_CtrlEnd =  14 + rn_updated  && Includes Ctrl-W - Terminate w/save
  2085.  1247:    rn_Enter   =  15      && Includes Ctrl-M  RETURN of fill last record
  2086.  1248:    rn_EnterA  =  16      && Enter at the beginning of a record in APPEND
  2087.  1249:    rn_CtrlHme =  33      && Ctrl-Home - Menu display toggle
  2088.  1250:    rn_CtrlPUp =  34      && Ctrl-PgUp - Zoom Out
  2089.  1251:    rn_CtrlPDn =  35      && Ctrl-PgDn - Zoom In
  2090.  1252:    rn_F1      =  36      && Help function key
  2091.  1253:  {lmarg(0)}
  2092.  1254:  ENDIF
  2093.  1255:  
  2094.  1256:  RETURN
  2095.  1257:  *-- EOP: _key_vars
  2096.  1258:  
  2097.  1259:  {return;
  2098.  1260:  enddef
  2099.  1261:  
  2100.  1262:  //--------------------------------------------------------------
  2101.  1263:  
  2102.  1264:  define check_for_gen_extensions()
  2103.  1265:     // Check for all the different extensions to forms support for this fmt file
  2104.  1266:     // Help extension
  2105.  1267:     var dbf_name;
  2106.  1268:     // next line modified to include rtrim statement per Bill Ramos
  2107.  1269:     hlp_name = frame_path + rtrim(substr( fileroot( fmt_name), 1, 6)) + "_H"
  2108.  1270:     if fileexist(hlp_name + ".DBF") and fileexist(hlp_name + ".DBT") then
  2109.  1271:        is_help = 1      // Global flag for help support
  2110.  1272:     // Following lines added by Barry Fox to prompt user for the name of the
  2111.  1273:     // the database to check for help support.  This allows the generation 
  2112.  1274:     // help support when the form name differs from the parent database 
  2113.  1275:     // name.  
  2114.  1276:       else
  2115.  1277:     dbf_name = askuser("Enter dbf name for help support or press ENTER to continue ","",12)
  2116.  1278:     hlp_name = frame_path + rtrim(substr( fileroot( dbf_name), 1, 6)) + "_H"
  2117.  1279:     if fileexist(hlp_name + ".DBF") and fileexist(hlp_name+ ".DBT" ) then
  2118.  1280:        is_help = 1
  2119.  1281:   endif
  2120.  1282:  endif
  2121.  1283:     foreach FLD_ELEMENT flds
  2122.  1284:         // Popup or Browse support
  2123.  1285:         if popup_or_browse(flds) then
  2124.  1286:            is_popup = 1
  2125.  1287:            workarea_cnt = workarea_cnt + 1
  2126.  1288:         endif
  2127.  1289:         // Zoom support
  2128.  1290:         if is_zoom(FLD_OK_COND) then
  2129.  1291:            is_zoom = 1
  2130.  1292:         endif
  2131.  1293:         // Recalc support
  2132.  1294:         if is_recalc(FLD_DESCRIPT) then
  2133.  1295:            is_recalc = 1
  2134.  1296:         endif
  2135.  1297:         // Replace lookup support
  2136.  1298:         if is_replace(FLD_OK_COND) then 
  2137.  1299:            is_replace = 1
  2138.  1300:         endif
  2139.  1301:     next flds
  2140.  1302:     if is_help or is_popup or is_zoom or is_recalc or is_replace then
  2141.  1303:        return 1;
  2142.  1304:     else
  2143.  1305:        return 0;
  2144.  1306:     endif
  2145.  1307:  enddef
  2146.  1308:  
  2147.  1309:  //--------------------------------------------------------------
  2148.  1310:  define popup_or_browse(cur)             // Pass in foreach cursor
  2149.  1311:     // Check for "popup" or "browse" string for this fmt file
  2150.  1312:     if at("POPUP",  upper(ltrim(cur.FLD_OK_COND))) == "2" or
  2151.  1313:        at("BROWSE", upper(ltrim(cur.FLD_OK_COND))) == "2" then
  2152.  1314:        return 1;
  2153.  1315:     else
  2154.  1316:        return 0;
  2155.  1317:     endif
  2156.  1318:  enddef
  2157.  1319:  
  2158.  1320:  //--------------------------------------------------------------
  2159.  1321:  define new_page(cur)               // Pass in foreach cursor
  2160.  1322:     // Checks for a page break and adjusts line_cnt and page_cnt
  2161.  1323:     if nul2zero(cur.ROW_POSITN) - line_cnt > scrn_size then
  2162.  1324:        line_cnt = line_cnt + scrn_size + 1;
  2163.  1325:        ++page_cnt;
  2164.  1326:        return 1;
  2165.  1327:     endif
  2166.  1328:  return 0;
  2167.  1329:  enddef
  2168.  1330:  
  2169.  1331:  //--------------------------------------------------------------
  2170.  1332:  define parse_line( before,         // Out: chars before the look_for string
  2171.  1333:                     input,          // In:  line being parsed
  2172.  1334:                     look_for        // In:  string searched for
  2173.  1335:                   )                 // Rtn: chars after the look_for string
  2174.  1336:       // If the look_for sting is not found, the before sting will equal the
  2175.  1337:       // input string, and the returned value will be NUL
  2176.  1338:       var location, after;
  2177.  1339:  
  2178.  1340:       location = at(look_for, upper(input))
  2179.  1341:       if location == 0 then
  2180.  1342:            before = input
  2181.  1343:            return ( "" );
  2182.  1344:       endif
  2183.  1345:  
  2184.  1346:       before = substr( input, 1, location-1)
  2185.  1347:       after  = substr( input, location)
  2186.  1348:       after  = substr( after, 1, len(after) - 1)
  2187.  1349:  
  2188.  1350:       return ( alltrim( substr( after,
  2189.  1351:                                  1 + len(look_for),
  2190.  1352:                                  get_next_key_word(
  2191.  1353:                                                    substr( after,
  2192.  1354:                                                            1 + len( look_for)
  2193.  1355:                                                          )
  2194.  1356:                                                    )
  2195.  1357:                               )
  2196.  1358:                       )
  2197.  1359:              );
  2198.  1360:  // end: parse_line()
  2199.  1361:  enddef
  2200.  1362:  
  2201.  1363:  //--------------------------------------------------------------
  2202.  1364:  define get_next_key_word(rest_of_str)   // String to search for keyword
  2203.  1365:     var str_length;
  2204.  1366:  
  2205.  1367:     str_length = len(rest_of_str)
  2206.  1368:     rest_of_str = upper(rest_of_str)
  2207.  1369:  
  2208.  1370:     for cnt = 1 to str_length
  2209.  1371:  
  2210.  1372:        if at(" ORDER", substr(rest_of_str, cnt)) == 1  or
  2211.  1373:           at(" REQ",   substr(rest_of_str, cnt)) == 1  or
  2212.  1374:           at(" SHADOW",substr(rest_of_str, cnt)) == 1  or
  2213.  1375:           at(" FIELDS",substr(rest_of_str, cnt)) == 1  or
  2214.  1376:           at(" UPDATE",substr(rest_of_str, cnt)) == 1  or
  2215.  1377:           at(" FORMAT",substr(rest_of_str, cnt)) == 1  or
  2216.  1378:           at(" FROM",  substr(rest_of_str, cnt)) == 1  or
  2217.  1379:           at(" REPLACE",  substr(rest_of_str, cnt)) == 1  or
  2218.  1380:           at(" ZOOM",  substr(rest_of_str, cnt)) == 1  then
  2219.  1381:             exit
  2220.  1382:        endif
  2221.  1383:  
  2222.  1384:     next
  2223.  1385:     return cnt - 1;
  2224.  1386:  enddef
  2225.  1387:  
  2226.  1388:  //--------------------------------------------------------------
  2227.  1389:  // Parsing routines for pulling objects out of the VALID string
  2228.  1390:  // "POPUP" = "file->fld_name ORDER key_fld REQ"
  2229.  1391:  // 1234567890123456789012345678901234567890123
  2230.  1392:  //            1         2         3         4
  2231.  1393:  define get_file(valid_str)
  2232.  1394:       var  s_arrow,            // String "->"
  2233.  1395:            test,
  2234.  1396:            s_equal,            // String "="
  2235.  1397:            next_alpha,
  2236.  1398:            at_alias,
  2237.  1399:            s_before,           // String before the searched for item
  2238.  1400:            r_target,           // Remainder of the target string after item
  2239.  1401:            use_name;           // Return for file
  2240.  1402:  
  2241.  1403:       s_arrow = "->"
  2242.  1404:       s_equal = "="
  2243.  1405:       r_target = parse_line( s_before, valid_str, s_equal )      // ' "file->...'
  2244.  1406:       next_alpha = atalpha(r_target)                             // 3
  2245.  1407:       at_alias = at(s_arrow, r_target)                           // 7
  2246.  1408:       use_name = substr(r_target,next_alpha,at_alias-next_alpha) // 'file'
  2247.  1409:  
  2248.  1410:       return cap_first(use_name);
  2249.  1411:  enddef
  2250.  1412:  
  2251.  1413:  //--------------------------------------------------------------
  2252.  1414:  define get_udfname(fld_str)
  2253.  1415:       // Create UDF name
  2254.  1416:       return cap_first( "l_" + substr( fld_str,1,6) );
  2255.  1417:  enddef
  2256.  1418:  
  2257.  1419:  //--------------------------------------------------------------
  2258.  1420:  define get_key(valid_str)
  2259.  1421:       var  s_order,            // String "ORDER "
  2260.  1422:            at_space,
  2261.  1423:            s_before,           // String before the searched for item
  2262.  1424:            r_target,           // Remainder of the target string after item
  2263.  1425:            order_tag;          // Search TAG to ORDER BY
  2264.  1426:  
  2265.  1427:       s_order = "ORDER "
  2266.  1428:       r_target = parse_line( s_before, valid_str, s_order ) // 'key_fld REQ'
  2267.  1429:       at_space = at(" ",r_target)
  2268.  1430:       if at_space == 0 then
  2269.  1431:            order_tag = substr(r_target, 1, len(r_target)) // 'key_fld"'
  2270.  1432:       else
  2271.  1433:            order_tag = substr(r_target, 1, at_space)
  2272.  1434:       endif
  2273.  1435:       return cap_first(order_tag);
  2274.  1436:  enddef
  2275.  1437:  
  2276.  1438:  //--------------------------------------------------------------
  2277.  1439:  define get_field(valid_str)
  2278.  1440:       var  s_arrow,            // String "->"
  2279.  1441:            at_space,
  2280.  1442:            s_before,           // String before the searched for item
  2281.  1443:            r_target,           // Remainder of the target string after item
  2282.  1444:            fld_name;           // Field name to lookup in target file
  2283.  1445:  
  2284.  1446:       s_arrow = "->"
  2285.  1447:       r_target = parse_line( s_before,
  2286.  1448:                              valid_str, s_arrow ) // 'fld_name ORDER...'
  2287.  1449:       at_space = at(" ",r_target)
  2288.  1450:  
  2289.  1451:       fld_name = ( at_space == 0 ? r_target : substr(r_target, 1, at_space-1) );
  2290.  1452:  
  2291.  1453:       return cap_first(fld_name);
  2292.  1454:  enddef
  2293.  1455:  
  2294.  1456:  //--------------------------------------------------------------
  2295.  1457:  define get_popname(valid_str)
  2296.  1458:       // Create popup name
  2297.  1459:       return ( lower( "l_" + substr( get_field( valid_str),1,6) ) );
  2298.  1460:  enddef
  2299.  1461:  
  2300.  1462:  //--------------------------------------------------------------
  2301.  1463:  define is_required(valid_str)
  2302.  1464:       // Determines if the field is required before moving to the next field
  2303.  1465:       return ( ( at(" REQ ",  upper(valid_str)) ? 1 : 0 ) or
  2304.  1466:                ( at(" REQ\"", upper(valid_str)) ? 1 : 0 )
  2305.  1467:              );
  2306.  1468:  enddef
  2307.  1469:  
  2308.  1470:  //--------------------------------------------------------------
  2309.  1471:  define is_shadow(valid_str)
  2310.  1472:       // Determines if the user wants shadowing for popup
  2311.  1473:       return ( ( at(" SHADOW ",  upper(valid_str)) ? 1 : 0 ) or
  2312.  1474:                ( at(" SHADOW\"", upper(valid_str)) ? 1 : 0 )
  2313.  1475:              );
  2314.  1476:  enddef
  2315.  1477:  
  2316.  1478:  //--------------------------------------------------------------
  2317.  1479:  define is_update(valid_str)
  2318.  1480:       // Determines if the user wants updating in the BROWSE
  2319.  1481:       return ( ( at(" UPDATE ",  upper(valid_str)) ? 1 : 0 ) or
  2320.  1482:                ( at(" UPDATE\"", upper(valid_str)) ? 1 : 0 )
  2321.  1483:              );
  2322.  1484:  enddef
  2323.  1485:  
  2324.  1486:  //--------------------------------------------------------------
  2325.  1487:  define is_format_file(k, valid_str)
  2326.  1488:      // Determines if the user has a format file entered and is valid
  2327.  1489:      var is_format, format_file;
  2328.  1490:  
  2329.  1491:      is_format = ( at(" FORMAT ", upper(valid_str)) ? 1 : 0 );
  2330.  1492:  
  2331.  1493:      if is_format then
  2332.  1494:         format_file = parse_line("", k.FLD_OK_COND, "FORMAT ")
  2333.  1495:         format_file = (at(".", format_file) ? format_file : format_file + ".fmt");
  2334.  1496:         is_format = ( fileexist(format_file) ? 1 : 0 );
  2335.  1497:       endif
  2336.  1498:  
  2337.  1499:       return is_format;
  2338.  1500:  enddef
  2339.  1501:  
  2340.  1502:  //--------------------------------------------------------------
  2341.  1503:  define is_window(valid_str)
  2342.  1504:       // Determines if the user wants windowing for BROWSE
  2343.  1505:       return ( at(" FROM ",upper(valid_str)) ? 1 : 0 );
  2344.  1506:  enddef
  2345.  1507:  
  2346.  1508:  //--------------------------------------------------------------
  2347.  1509:  define is_fields(valid_str)
  2348.  1510:       // Determines if the user wants to set fields for BROWSE
  2349.  1511:       return ( at(" FIELDS ",upper(valid_str)) ? 1 : 0 );
  2350.  1512:  enddef
  2351.  1513:  
  2352.  1514:  //--------------------------------------------------------------
  2353.  1515:  define is_zoom(valid_str)
  2354.  1516:       // Determines if the field wants zoom before moving to the next field    
  2355.  1517:       return ( ( at(" ZOOM ",  upper(valid_str)) ? 1 : 0 ) or
  2356.  1518:                ( at(" ZOOM\"", upper(valid_str)) ? 1 : 0 )
  2357.  1519:              );
  2358.  1520:  enddef
  2359.  1521:  
  2360.  1522:  //--------------------------------------------------------------
  2361.  1523:  define is_recalc(descrip_str)
  2362.  1524:       // Determines if the users wants recalc on calculated fields
  2363.  1525:       return  ( at("RECALC",  upper(descrip_str)) ? 1 : 0 );
  2364.  1526:  enddef
  2365.  1527:  
  2366.  1528:  //--------------------------------------------------------------
  2367.  1529:  define is_replace(valid_str)
  2368.  1530:       // Determines if the users wants recalc on calculated fields
  2369.  1531:       return  ( at(" REPLACE ",  upper(valid_str)) ? 1 : 0 );
  2370.  1532:  enddef
  2371.  1533:  
  2372.  1534:  //--------------------------------------------------------------
  2373.  1535:  define get_pop_shadow(field_template)   // Pass in FLD_TEMPLATE to deter. shadow
  2374.  1536:       if trow_positn < max_pop_row then
  2375.  1537:          trow_positn + 1},{tcol_positn},{scrn_size-1},{tcol_positn+len(Field_template)+1}
  2376.  1538:  {    else
  2377.  1539:          trow_positn - 11},{tcol_positn},{trow_positn - 1},{tcol_positn+len(Field_template)+1}
  2378.  1540:  {    endif
  2379.  1541:       return;
  2380.  1542:  enddef
  2381.  1543:  
  2382.  1544:  //--------------------------------------------------------------
  2383.  1545:  define get_browse_shadow(from_to)
  2384.  1546:       // Determine shadow coordinates for BROWSE
  2385.  1547:  
  2386.  1548:       var from_clause, from_coord, to_coord, r1, c1, r2, c2;
  2387.  1549:  
  2388.  1550:       // Get From clause for the DEFINE WINDOW
  2389.  1551:       from_clause = alltrim( upper( parse_line("", from_to, "FROM ")))
  2390.  1552:  
  2391.  1553:       if !from_clause then return ""; endif
  2392.  1554:  
  2393.  1555:       // Get FROM coordinates
  2394.  1556:       from_coord = alltrim( substr( from_clause, 1, at("TO", from_clause) - 1))
  2395.  1557:       r1 = substr( from_coord, 1, at(",", from_coord)-1)
  2396.  1558:       c1 = substr( from_coord, at(",", from_coord)+1)
  2397.  1559:  
  2398.  1560:       // Get TO coordinates
  2399.  1561:       to_coord   = alltrim( substr( from_clause, at("TO", from_clause) + 2))
  2400.  1562:       r2 = substr( to_coord, 1, at(",", to_coord)-1)
  2401.  1563:       // Check shadow height and adjust if necessary
  2402.  1564:       r2 = (val( r2) + 1) <= scrn_size ? r2 : str( scrn_size - 1) ;
  2403.  1565:  
  2404.  1566:       c2 = substr( to_coord, at(",", to_coord)+1)
  2405.  1567:       // Check shadow width and adjust if necessary
  2406.  1568:       c2 = (val(c2)+2) <= 79 ? c2 : str(77) ;
  2407.  1569:  
  2408.  1570:       print( r1 + "," + c1 + "," + r2 + "," + c2)
  2409.  1571:       return;
  2410.  1572:  enddef
  2411.  1573:  
  2412.  1574:  //--------------------------------------------------------------
  2413.  1575:  define get_browse_fields_list(k)
  2414.  1576:    // Search for "FIELDS" in FLD_OK_COND and return the field list for BROWSE
  2415.  1577:    var field_list, key_length;
  2416.  1578:  
  2417.  1579:    field_list = parse_line("", k.FLD_OK_COND, "FIELDS ")
  2418.  1580:    key_length = len( temp_key)
  2419.  1581:  
  2420.  1582:    if is_update(k.FLD_OK_COND) then
  2421.  1583:      // Add /R readonly flag to KEY field of lookup table, if updateable
  2422.  1584:      return substr( field_list, 1, at( upper(temp_key), upper(field_list)) + key_length -1)
  2423.  1585:              + " /R" +
  2424.  1586:            substr( field_list, at( upper(temp_key), upper(field_list)) + key_length);
  2425.  1587:    else
  2426.  1588:      return field_list;
  2427.  1589:    endif
  2428.  1590:  enddef
  2429.  1591:  
  2430.  1592:  //--------------------------------------------------------------
  2431.  1593:  define get_browse_window(k)
  2432.  1594:    // Search for "FROM" in FLD_OK_COND and return the list for BROWSE
  2433.  1595:    return parse_line("", k.FLD_OK_COND, "FROM ");
  2434.  1596:  enddef
  2435.  1597:  
  2436.  1598:  //--------------------------------------------------------------
  2437.  1599:  define get_format_file(_file)
  2438.  1600:    // Search for "FORMAT" in FLD_OK_COND and return the NAME for BROWSE
  2439.  1601:    return cap_first(parse_line("", _file, "FORMAT "))
  2440.  1602:  enddef
  2441.  1603:  
  2442.  1604:  define get_zoom_format_file(_file)
  2443.  1605:   // Search for "ZOOM" in FLD_OK_COND and return the FORMAT NAME for EDIT
  2444.  1606:    return cap_first(parse_line("", _file, "ZOOM "));
  2445.  1607:  enddef
  2446.  1608:  
  2447.  1609:  define make_zoom_to_form()
  2448.  1610:    var zoom_name, lookup_dbf;
  2449.  1611:    zoom_name = "Z_" + lower(rtrim(substr(name,1,6)))
  2450.  1612:    if !is_zoom then
  2451.  1613:      return 0;
  2452.  1614:    endif
  2453.  1615:    print(crlf + "*"+replicate("-",78)+crlf);
  2454.  1616:  }
  2455.  1617:  PROCEDURE {zoom_name}
  2456.  1618:  *-- Branch to another EDIT form based on lc_var
  2457.  1619:  PARAMETER lc_var
  2458.  1620:  PRIVATE ALL LIKE l?_*
  2459.  1621:  
  2460.  1622:  ON KEY LABEL {on_key_zoom}
  2461.  1623:  SAVE SCREEN TO {zoom_name}
  2462.  1624:  lc_area = ALIAS()
  2463.  1625:  ll_edit = .F.
  2464.  1626:  SELECT SELECT()
  2465.  1627:  DO CASE
  2466.  1628:  {  foreach FLD_ELEMENT flds
  2467.  1629:        if is_zoom( FLD_OK_COND) then
  2468.  1630:          lookup_dbf = get_file( FLD_OK_COND);
  2469.  1631:  }
  2470.  1632:     CASE lc_var = "{FLD_FIELDNAME}"
  2471.  1633:  {        if workarea_cnt > max_workareas then}
  2472.  1634:        IF FILE("{lookup_dbf}.dbf")
  2473.  1635:           USE {lookup_dbf} ORDER {alltrim(get_key( FLD_OK_COND))}
  2474.  1636:  {            if chr( FLD_VALUE_TYPE) == "C" then}
  2475.  1637:           lc_var = IIF( EMPTY( TRIM( lc_var)), lc_var, TRIM( lc_var))
  2476.  1638:  {            endif
  2477.  1639:           else
  2478.  1640:  }
  2479.  1641:           SELECT ("{ upper(lookup_dbf) == FLD_FILENAME ? 
  2480.  1642:                                                "A"+substr(lookup_dbf,1,7) : 
  2481.  1643:                                                 lookup_dbf}")
  2482.  1644:  {         endif   }
  2483.  1645:           SEEK &lc_area.->&lc_var.
  2484.  1646:  
  2485.  1647:           IF FILE("{fileroot( get_zoom_format_file( FLD_OK_COND)) + ".FMT"}")
  2486.  1648:               SET FORMAT TO {fileroot( get_zoom_format_file(FLD_OK_COND))}
  2487.  1649:           ENDIF
  2488.  1650:           ll_edit = .T.
  2489.  1651:  {        if workarea_cnt > max_workareas then}
  2490.  1652:        ENDIF
  2491.  1653:  {         endif
  2492.  1654:        endif       
  2493.  1655:     next
  2494.  1656:  }
  2495.  1657:     OTHERWISE
  2496.  1658:         KEYBOARD CHR( kn_CtrlHme ) CLEAR          && Gets user into memo field
  2497.  1659:  ENDCASE
  2498.  1660:  
  2499.  1661:  IF ll_edit
  2500.  1662:     EDIT NEXT 1                                   && Edit the Zoomed record
  2501.  1663:  ENDIF
  2502.  1664:  
  2503.  1665:  {  if workarea_cnt > max_workareas then}
  2504.  1666:  USE
  2505.  1667:  {  endif}
  2506.  1668:  SELECT (lc_area)                                 && Back to edit work area
  2507.  1669:  RESTORE SCREEN FROM {zoom_name}
  2508.  1670:  RELEASE SCREEN {zoom_name}
  2509.  1671:  {  if is_help then}
  2510.  1672:  ON KEY LABEL {on_key_help} DO {"H_" + lower(rtrim(substr(name,1,6)))} WITH VARREAD()
  2511.  1673:  {  endif
  2512.  1674:     if is_recalc then}
  2513.  1675:  ON KEY LABEL {on_key_recalc} DO {"R_" + lower(rtrim(substr(name,1,6)))} WITH VARREAD()
  2514.  1676:  {  endif}
  2515.  1677:  ON KEY LABEL {on_key_cut} DO _Cut
  2516.  1678:  ON KEY LABEL {on_key_paste} DO _Paste
  2517.  1679:  ON KEY LABEL {on_key_edpaste} DO _Edpaste
  2518.  1680:  ON KEY LABEL {on_key_zoom} DO {zoom_name} WITH VARREAD()
  2519.  1681:  RETURN
  2520.  1682:  *-- EOP: {zoom_name}
  2521.  1683:  {enddef
  2522.  1684:  
  2523.  1685:  define make_recalc_code()
  2524.  1686:    var recalc_name;
  2525.  1687:    recalc_name = "R_" + lower(rtrim(substr(name,1,6)))
  2526.  1688:    if !is_recalc then
  2527.  1689:      return 0;
  2528.  1690:    endif
  2529.  1691:    if !udf_file then
  2530.  1692:       if !make_udf() then
  2531.  1693:          return 0;
  2532.  1694:       endif
  2533.  1695:       // Put up the UDF header
  2534.  1696:       udf_header()
  2535.  1697:    endif
  2536.  1698:    print(crlf + "*"+replicate("-",78)+crlf);
  2537.  1699:  }
  2538.  1700:  PROCEDURE {recalc_name}
  2539.  1701:  *-- Recalculate calculated fields
  2540.  1702:  PARAMETER lc_var
  2541.  1703:  PRIVATE ALL LIKE l?_*
  2542.  1704:  ON KEY LABEL {on_key_recalc}
  2543.  1705:  
  2544.  1706:  {textopen( fmt_name + ".tmp")
  2545.  1707:   temp = textgetl();
  2546.  1708:   if page_cnt > 1 then
  2547.  1709:  }
  2548.  1710:  DO CASE
  2549.  1711:     CASE lc_var $ "{temp}"
  2550.  1712:  {   lmarg(offset*2)
  2551.  1713:   endif
  2552.  1714:   color_flg = line_cnt = 0;
  2553.  1715:   foreach FLD_ELEMENT k
  2554.  1716:     if new_page(k) then
  2555.  1717:        temp = textgetl();
  2556.  1718:        lmarg(offset)
  2557.  1719:  }
  2558.  1720:  
  2559.  1721:   CASE lc_var $ "{temp}"
  2560.  1722:  {     lmarg(offset*2)
  2561.  1723:     endif
  2562.  1724:     color = getcolor(FLD_DISPLAY, FLD_EDITABLE) // get color of element
  2563.  1725:     if FLD_FIELDTYPE == calc and is_recalc(FLD_DESCRIPT) then}
  2564.  1726:  *-- Calculated field: {cap_first(FLD_FIELDNAME)} - {FLD_DESCRIPT}
  2565.  1727:  @ {nul2zero(ROW_POSITN) - line_cnt},{nul2zero(COL_POSITN)} SAY \
  2566.  1728:  {  // Loop thru expression in case it is longer than 237
  2567.  1729:         foreach FLD_EXPRESSION fcursor in k
  2568.  1730:            FLD_EXPRESSION}
  2569.  1731:  {      next}
  2570.  1732:  // Output a space after the Fld_expression and get ready for picture clause
  2571.  1733:   \
  2572.  1734:  {      if Ok_Template(k) then}
  2573.  1735:  PICTURE "{picture_for_say(k);}" \
  2574.  1736:  {      endif
  2575.  1737:         outcolor()}
  2576.  1738:  
  2577.  1739:  {  endif
  2578.  1740:   next k;
  2579.  1741:   if page_cnt > 1 then
  2580.  1742:     lmarg(0)
  2581.  1743:  }
  2582.  1744:  ENDCASE
  2583.  1745:  {endif}
  2584.  1746:  
  2585.  1747:  ON KEY LABEL {on_key_recalc} DO {"R_" + lower(rtrim(substr(name,1,6)))} WITH VARREAD()
  2586.  1748:  RETURN
  2587.  1749:  *-- EOP: {recalc_name}
  2588.  1750:  { textclose()
  2589.  1751:    fileerase( fmt_name + ".tmp")
  2590.  1752:  enddef
  2591.  1753:  
  2592.  1754:  define write_recalc_get_list()
  2593.  1755:   if is_recalc then                // Write get list out for each page
  2594.  1756:      append( fmt_name + ".tmp")    // Used for "recalc" option
  2595.  1757:      print( get_list + crlf)
  2596.  1758:      append( fmt_name + ".fmt")
  2597.  1759:   endif
  2598.  1760:  enddef
  2599.  1761:  
  2600.  1762:  //--------------------------------------------------------------
  2601.  1763:  define make_replace_code()
  2602.  1764:    // Make REPLACE and @ GET statements for other fields related to the LOOKUP
  2603.  1765:    var replace_field_name, field_list, temp2;
  2604.  1766:  
  2605.  1767:    if !is_replace then
  2606.  1768:      return 0;
  2607.  1769:    endif
  2608.  1770:  
  2609.  1771:    color_flg = line_cnt = 0;
  2610.  1772:  
  2611.  1773:    foreach FLD_ELEMENT x
  2612.  1774:      if is_replace( FLD_OK_COND ) then  // found a field with REPLACE
  2613.  1775:        replace_field_name = "U_" + lower( rtrim( substr( FLD_FIELDNAME, 1, 7)));
  2614.  1776:        print(crlf + "*"+replicate("-",78)+crlf);
  2615.  1777:  }
  2616.  1778:  PROCEDURE {replace_field_name}
  2617.  1779:     PARAMETER is_edit, key_field
  2618.  1780:     *-- Update Look'ed up fields for {cap_first( FLD_FIELDNAME )}
  2619.  1781:  
  2620.  1782:  {     if  at("POPUP", upper(ltrim(FLD_OK_COND))) then}
  2621.  1783:     SEEK key_field
  2622.  1784:  
  2623.  1785:  {     endif
  2624.  1786:        lmarg(4)
  2625.  1787:        get_replace_fields_list(x) 
  2626.  1788:        get_memvar_fields_list(x) 
  2627.  1789:        lmarg(0)
  2628.  1790:  }
  2629.  1791:  
  2630.  1792:     IF is_edit
  2631.  1793:  {     foreach FLD_ELEMENT y
  2632.  1794:           if is_replace( y.FLD_OK_COND) and x == y then
  2633.  1795:  
  2634.  1796:               field_list = upper( parse_line( "", y.FLD_OK_COND, "REPLACE ") )
  2635.  1797:               do while len(field_list) > 0
  2636.  1798:                  temp = upper( substr( field_list, 1, at(" WITH", field_list) - 1 ))
  2637.  1799:                  temp2 = at("M->",  upper(temp)) ?
  2638.  1800:                         substr( temp, at("M->", upper(temp)) + 3 ) :
  2639.  1801:                         temp;
  2640.  1802:                  foreach FLD_ELEMENT z
  2641.  1803:                     if FLD_FIELDNAME == alltrim( temp2 ) then
  2642.  1804:                        color = getcolor(z.FLD_DISPLAY, z.FLD_EDITABLE); // get color of element
  2643.  1805:  }
  2644.  1806:        @ {z.ROW_POSITN},{z.COL_POSITN} GET \
  2645.  1807:  {                     if at("M->",  upper(temp)) then
  2646.  1808:                           temp}
  2647.  1809:  {                     else
  2648.  1810:                           cap_first(z.FLD_FILENAME)}->\
  2649.  1811:  {                        cap_first(z.FLD_FIELDNAME)}\
  2650.  1812:  {                     endif
  2651.  1813:                        if Ok_Template(z) then}
  2652.  1814:   PICTURE "{picture_for_get(z);}" \
  2653.  1815:  {                        outcolor()}
  2654.  1816:  {                     endif}
  2655.  1817:  
  2656.  1818:  {                     exit
  2657.  1819:                     endif
  2658.  1820:                  next z
  2659.  1821:                  if at( ",", field_list) > 0 then
  2660.  1822:                     field_list = substr( field_list, at( ",", field_list) + 1 )
  2661.  1823:                  else
  2662.  1824:                     field_list = ""
  2663.  1825:                  endif
  2664.  1826:               enddo
  2665.  1827:  }
  2666.  1828:     ENDIF
  2667.  1829:  RETURN
  2668.  1830:  *-- EOP: {replace_field_name}
  2669.  1831:  
  2670.  1832:  {            exit
  2671.  1833:           endif
  2672.  1834:        next y 
  2673.  1835:      endif
  2674.  1836:    next x
  2675.  1837:   return;
  2676.  1838:  enddef
  2677.  1839:  
  2678.  1840:  //--------------------------------------------------------------
  2679.  1841:  define get_replace_fields_list(k)
  2680.  1842:    // Search for "REPLACE" in FLD_OK_COND and return the field list for REPLACE
  2681.  1843:    var field_list, key_length, first_loop;
  2682.  1844:  
  2683.  1845:    first_loop = 1;
  2684.  1846:    // Get REPLACE field data
  2685.  1847:    field_list = upper( parse_line( "",k.FLD_OK_COND, "REPLACE ") )
  2686.  1848:  
  2687.  1849:    // Fix the data up and print on multiple lines
  2688.  1850:    do while len( field_list) > 0
  2689.  1851:       if !at("M->", upper(substr(field_list, 1, at(" WITH", field_list) - 1 ))) then
  2690.  1852:          if first_loop then
  2691.  1853:             print("REPLACE ")
  2692.  1854:             first_loop = 0
  2693.  1855:          else
  2694.  1856:             print( ", ;" + crlf + space( 7))
  2695.  1857:          endif
  2696.  1858:          print( cap_first( k.FLD_FILENAME) + "->" +
  2697.  1859:                  cap_first(alltrim(substr(field_list, 1, at(" WITH", field_list) - 1 ))) +
  2698.  1860:                  " WITH "
  2699.  1861:               )
  2700.  1862:  
  2701.  1863:          temp = cap_first( alltrim( substr( field_list, at( "WITH", field_list) + 4 )))
  2702.  1864:          if at( ",", temp) > 0 then
  2703.  1865:             temp = substr( temp, 1, at( ",", temp) - 1 )
  2704.  1866:          endif
  2705.  1867:  
  2706.  1868:          print( temp)
  2707.  1869:       endif
  2708.  1870:       if at( ",", field_list) > 0 then
  2709.  1871:          field_list = substr( field_list, at(",", field_list) + 1 );
  2710.  1872:          if len( alltrim( field_list) ) == 0 then
  2711.  1873:             field_list = ""
  2712.  1874:          endif
  2713.  1875:       else
  2714.  1876:          field_list = ""
  2715.  1877:       endif
  2716.  1878:    enddo
  2717.  1879:    print( crlf )
  2718.  1880:    return ;
  2719.  1881:  enddef
  2720.  1882:  
  2721.  1883:  define get_memvar_fields_list(k)
  2722.  1884:    // Search for "REPLACE" in FLD_OK_COND and return the field list for MEMVAR
  2723.  1885:    // declaration
  2724.  1886:    var field_list, key_length;
  2725.  1887:  
  2726.  1888:    field_list = upper( parse_line( "",k.FLD_OK_COND, "REPLACE ") )
  2727.  1889:    // Produce memvar statements instead of replace statements
  2728.  1890:    do while len( field_list) > 0
  2729.  1891:       if at("M->", upper(substr(field_list, 1, at(" WITH", field_list) - 1 ))) then
  2730.  1892:          // Before "WITH"
  2731.  1893:          print( cap_first( alltrim( substr(field_list, 1, 
  2732.  1894:                         at(" WITH", field_list) - 1 ))) +
  2733.  1895:                  " = "
  2734.  1896:               )
  2735.  1897:          // After "WITH"
  2736.  1898:          temp = cap_first( alltrim( substr( field_list, at( "WITH", field_list) + 4 )))
  2737.  1899:          if at( ",", temp) > 0 then
  2738.  1900:             temp = substr( temp, 1, at( ",", temp) - 1 )
  2739.  1901:          endif
  2740.  1902:          print( temp + crlf)
  2741.  1903:       endif
  2742.  1904:  
  2743.  1905:       if at( ",", field_list) > 0 then
  2744.  1906:           field_list = substr( field_list, at(",", field_list) + 1 )
  2745.  1907:          if len( alltrim( field_list) ) == 0 then
  2746.  1908:             field_list = ""
  2747.  1909:          endif
  2748.  1910:       else
  2749.  1911:          field_list = ""
  2750.  1912:       endif
  2751.  1913:    enddo
  2752.  1914:    return ;
  2753.  1915:  enddef
  2754.  1916:  
  2755.  1917:  define make_memvar_declarations()
  2756.  1918:      // Make memvars for lookups
  2757.  1919:      foreach FLD_ELEMENT 
  2758.  1920:         if FLD_FIELDTYPE == memvar then
  2759.  1921:  }
  2760.  1922:  IF TYPE("M->{FLD_FIELDNAME}") = "U"
  2761.  1923:     m->{FLD_FIELDNAME} = \
  2762.  1924:  {          if chr(FLD_VALUE_TYPE) == "C" then
  2763.  1925:                 print("SPACE(" + len(FLD_TEMPLATE) + ")")
  2764.  1926:             endif
  2765.  1927:            if at(chr(FLD_VALUE_TYPE), "NF") then
  2766.  1928:                 print("0")
  2767.  1929:             endif
  2768.  1930:            if chr(FLD_VALUE_TYPE) == "D" then
  2769.  1931:                 print("{  \  \  }")
  2770.  1932:             endif
  2771.  1933:            if chr(FLD_VALUE_TYPE) == "L" then
  2772.  1934:                 print(".F.")
  2773.  1935:             endif     //
  2774.  1936:             print(crlf)
  2775.  1937:  }
  2776.  1938:  ENDIF
  2777.  1939:  {
  2778.  1940:         endif
  2779.  1941:       next
  2780.  1942:  return ;     
  2781.  1943:  enddef
  2782.  1944:  }
  2783.  1945:    571:  //---------------------------------------------------------------------------
  2784.   572:  }
  2785.   573:  // EOP CCB_FORM.COD
  2786.   574:  Compilation complete (no errors).
  2787.