home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / dataflex / dirlist.pkg < prev    next >
Encoding:
Text File  |  1993-08-10  |  4.0 KB  |  121 lines

  1. //************************************************************************
  2. //
  3. // Copyright 1987-1992 Data Access Corporation, Miami FL, USA
  4. // All Rights reserved
  5. // DataFlex is a registered trademark of Data Access Corporation.
  6. //
  7. //
  8. //     $Source: /u3/source.30/product/pkg/RCS/dirlist.pkg,v $
  9. //     $Revision: 1.1 $
  10. //     $State: Exp $
  11. //     $Author: james $
  12. //     $Date: 1992/09/08 14:43:04 $
  13. //     $Locker:  $
  14. //
  15. //     $Log: dirlist.pkg,v $
  16. //Revision 1.1  1992/09/08  14:43:04  james
  17. //Initial revision
  18. //
  19. //Revision 1.5  92/05/14  16:46:57  SWM
  20. //Updated Copyright slug.
  21. //
  22. //Revision 1.4  92/04/13  16:34:22  lee
  23. //changed comment for macro command from dlstart to drstart.
  24. //
  25. //Revision 1.3  92/03/29  18:44:51  lee
  26. //added MSG_END_CONSTRUCT_OBJECT, moved ENDMAC macro stuff into END_CONSTRUCT-
  27. //OBJECT procedures (in .pkgs). moved Flag_ITems to list.pkg after generalizing
  28. //it based on PROTOTYPE_OBJECT instead of Whether or not it is a table-oriented
  29. //object. Moved define_access_keys mechanism completely into actionbr.pkg.
  30. //fixed two typos: import_class_protocol used !# instead of !3, and register-
  31. //procedure used !1 instead of !2.
  32. //
  33. //Revision 1.2  92/03/09  19:01:15  james
  34. //Added #CHKSUB directive to insure source
  35. //only compiled with correct revision of 
  36. //compiler.
  37. //
  38. //Revision 1.1  91/10/23  10:20:18  elsa
  39. //Initial revision
  40. //
  41. //************************************************************************/
  42.  
  43. //************************************************************************
  44. //     File Name: DirList.Pkg
  45. // Creation Date: January 1, 1991
  46. // Modified Date: May 23, 1991
  47. //     Author(s): Steven A. Lowe
  48. //
  49. // This module contains the Directory_List class definition.
  50. //************************************************************************/
  51.  
  52. #CHKSUB 1 1 // Verify the UI subsystem.
  53.  
  54. Use PickList
  55.  
  56.  
  57. Class Directory_List is a Pick_List STARTMAC drStart
  58.   procedure construct_object integer myImg
  59.     forward send construct_object myImg
  60.     Property string File_Pattern PUBLIC "*"
  61.   end_procedure
  62.   //
  63.   //Operation: Fill_List
  64.   //
  65.   //Assumption(s): none
  66.   //
  67.   //Goal(s): Read directory matching value of File_Name_Pattern and display
  68.   //  in list in ascending order, without showing [.] and [..] entries.
  69.   //
  70.   //Algorithm: Augmented to get value of File_Name_Pattern item and uses as
  71.   //  pattern for opening sequential directory device.  File names are read
  72.   //  from the Directory device one at a time; the file names [.] and [..]
  73.   //  are checked for and ignored.  Sends SORT_ITEMS to sort file names
  74.   //
  75.   //Usage: invoked prior to activation.
  76.   //
  77.   procedure Fill_List
  78.     local string aStr patternStr
  79.     local integer dynUpdt
  80.     get Dynamic_Update_State to dynUpdt
  81.     set Dynamic_Update_State to false
  82.     forward send Fill_List
  83.     get File_Pattern to patternStr
  84.     uppercase patternStr                 //force to uppercase characters
  85.     insert "DIR:" in patternStr at 1     //insert directory device name
  86.     direct_input patternStr              //open directory listing
  87.     readln aStr         //read first filename
  88.     while [not seqeof]
  89.       trim aStr to aStr                  //[.] & [..] ignored
  90.       if (left(aStr,1)) ne "[" send add_item msg_none aStr
  91.       readln aStr
  92.     end
  93.     close_input
  94.     send SORT_ITEMS ASCENDING
  95.     set Dynamic_Update_State to dynUpdt
  96.   end_procedure
  97. end_class
  98.  
  99. //
  100. // Support Commands
  101. //
  102.  
  103. //
  104. // drStart <class> <image> { ACTION_BAR <actionbar#> } { POP_UP } { RING }
  105. //        { RADIO } { FOR <fieldName> } { PATTERN <filePattern> }
  106. //
  107. #COMMAND DRSTART R R
  108.   FORWARD_BEGIN_CONSTRUCT !1 !2 !3 !4 !5 !6 !7 !8 !9
  109.   bind_pattern !3 !4 !5 !6 !7 !8 !9
  110. #ENDCOMMAND
  111.  
  112. #COMMAND Bind_Pattern
  113.   #IF (!0>1)
  114.     #IFSAME !1 PATTERN
  115.       set File_Pattern to !2
  116.     #ELSE
  117.       Bind_Pattern !2 !3 !4 !5 !6 !7 !8 !9
  118.     #ENDIF
  119.   #ENDIF
  120. #ENDCOMMAND
  121.