home *** CD-ROM | disk | FTP | other *** search
/ DOS Wares / doswares.zip / doswares / DATABASE / DBASE5 / CUA_SAMP.ZIP / BLDFILE.PRG < prev    next >
Encoding:
Text File  |  1994-06-24  |  1.7 KB  |  47 lines

  1. PROCEDURE BldFile
  2. PARAMETERS pcSpec, poListBox
  3. *----------------------------------------------------------------------------
  4. * NAME
  5. *   BldFile - Use the file spec to set DataSource for poListBox
  6. *
  7. * PARAMETERS
  8. *   pcSpec     = File spec with ? or *
  9. *   poListBox  = Object ref to list box or combo box.
  10. *
  11. *----------------------------------------------------------------------------
  12.     PRIVATE nFiles, nVoid, cSource
  13.  
  14.     DECLARE dB5___OFls[1,5]
  15.  
  16.     *----------------------------------------------------------------
  17.     *-- Build an array containing the list of files for the file spec
  18.     *----------------------------------------------------------------
  19.     nFiles = ADIR( dB5___OFls, LTRIM(TRIM(m->pcSpec) ) )
  20.  
  21.     IF nFiles > 0
  22.  
  23.         *-----------------------------------------------------------------
  24.         *-- Reshape the two dimensional array down to a single using ACOPY
  25.         *-----------------------------------------------------------------
  26.         DECLARE dB5___ORes[m->nFiles]
  27.         nFiles = ACOPY( dB5___OFls, ;
  28.                         dB5___ORes, ;
  29.                         AELEMENT( dB5___OFls, 1, 1 ), ;
  30.                         AELEMENT( dB5___OFls, m->nFiles, 1 ) , ;
  31.                         1, 1 )
  32.  
  33.         nVoid = ASORT( dB5___ORes )
  34.         cSource = "ARRAY dB5___ORes"
  35.     ELSE
  36.         cSource = "STRING <Empty>"
  37.     ENDIF
  38.  
  39.     *-------------------------------------------------------------
  40.     *-- Set the DataSource for the list box based on the file list
  41.     *-------------------------------------------------------------
  42.     poListBox.DataSource = m->cSource
  43.  
  44. RETURN
  45. *-- EOP: BldFile WITH pcFileName, poListBox
  46.  
  47.