home *** CD-ROM | disk | FTP | other *** search
- //************************************************************************
- //
- // Copyright 1987-1992 Data Access Corporation, Miami FL, USA
- // All Rights reserved
- // DataFlex is a registered trademark of Data Access Corporation.
- //
- //
- // $Source: /u3/source.30/product/pkg/RCS/dirlist.pkg,v $
- // $Revision: 1.1 $
- // $State: Exp $
- // $Author: james $
- // $Date: 1992/09/08 14:43:04 $
- // $Locker: $
- //
- // $Log: dirlist.pkg,v $
- //Revision 1.1 1992/09/08 14:43:04 james
- //Initial revision
- //
- //Revision 1.5 92/05/14 16:46:57 SWM
- //Updated Copyright slug.
- //
- //Revision 1.4 92/04/13 16:34:22 lee
- //changed comment for macro command from dlstart to drstart.
- //
- //Revision 1.3 92/03/29 18:44:51 lee
- //added MSG_END_CONSTRUCT_OBJECT, moved ENDMAC macro stuff into END_CONSTRUCT-
- //OBJECT procedures (in .pkgs). moved Flag_ITems to list.pkg after generalizing
- //it based on PROTOTYPE_OBJECT instead of Whether or not it is a table-oriented
- //object. Moved define_access_keys mechanism completely into actionbr.pkg.
- //fixed two typos: import_class_protocol used !# instead of !3, and register-
- //procedure used !1 instead of !2.
- //
- //Revision 1.2 92/03/09 19:01:15 james
- //Added #CHKSUB directive to insure source
- //only compiled with correct revision of
- //compiler.
- //
- //Revision 1.1 91/10/23 10:20:18 elsa
- //Initial revision
- //
- //************************************************************************/
-
- //************************************************************************
- // File Name: DirList.Pkg
- // Creation Date: January 1, 1991
- // Modified Date: May 23, 1991
- // Author(s): Steven A. Lowe
- //
- // This module contains the Directory_List class definition.
- //************************************************************************/
-
- #CHKSUB 1 1 // Verify the UI subsystem.
-
- Use PickList
-
-
- Class Directory_List is a Pick_List STARTMAC drStart
- procedure construct_object integer myImg
- forward send construct_object myImg
- Property string File_Pattern PUBLIC "*"
- end_procedure
- //
- //Operation: Fill_List
- //
- //Assumption(s): none
- //
- //Goal(s): Read directory matching value of File_Name_Pattern and display
- // in list in ascending order, without showing [.] and [..] entries.
- //
- //Algorithm: Augmented to get value of File_Name_Pattern item and uses as
- // pattern for opening sequential directory device. File names are read
- // from the Directory device one at a time; the file names [.] and [..]
- // are checked for and ignored. Sends SORT_ITEMS to sort file names
- //
- //Usage: invoked prior to activation.
- //
- procedure Fill_List
- local string aStr patternStr
- local integer dynUpdt
- get Dynamic_Update_State to dynUpdt
- set Dynamic_Update_State to false
- forward send Fill_List
- get File_Pattern to patternStr
- uppercase patternStr //force to uppercase characters
- insert "DIR:" in patternStr at 1 //insert directory device name
- direct_input patternStr //open directory listing
- readln aStr //read first filename
- while [not seqeof]
- trim aStr to aStr //[.] & [..] ignored
- if (left(aStr,1)) ne "[" send add_item msg_none aStr
- readln aStr
- end
- close_input
- send SORT_ITEMS ASCENDING
- set Dynamic_Update_State to dynUpdt
- end_procedure
- end_class
-
- //
- // Support Commands
- //
-
- //
- // drStart <class> <image> { ACTION_BAR <actionbar#> } { POP_UP } { RING }
- // { RADIO } { FOR <fieldName> } { PATTERN <filePattern> }
- //
- #COMMAND DRSTART R R
- FORWARD_BEGIN_CONSTRUCT !1 !2 !3 !4 !5 !6 !7 !8 !9
- bind_pattern !3 !4 !5 !6 !7 !8 !9
- #ENDCOMMAND
-
- #COMMAND Bind_Pattern
- #IF (!0>1)
- #IFSAME !1 PATTERN
- set File_Pattern to !2
- #ELSE
- Bind_Pattern !2 !3 !4 !5 !6 !7 !8 !9
- #ENDIF
- #ENDIF
- #ENDCOMMAND
-