Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

DirList – PB Docs 150 – PowerBuilder Library

DirList – PB Docs 150

DirList PowerScript function

Description

Populates a ListBox with a list of files. You can specify
a path, a mask, and a file type to restrict the set of files displayed.
If the window has an associated StaticText control, DirList can
display the current drive and directory as well.

Controls

ListBox, DropDownListBox, PictureListBox, and DropDownPictureListBox controls

Syntax

Argument

Description

listboxname

The name of the ListBox control you want
to populate.

filespec

A string whose value is the file pattern.
This is usually a mask (for example, *.INI or *.TXT).
If you include a path, it becomes the current drive and directory.

filetype

An unsigned integer representing one
or more types of files you want to list in the ListBox. Types are:

  • 0 – Read/write
    files

  • 1 – Read-only files

  • 2 – Hidden files

  • 4 – System files

  • 16 – Subdirectories

  • 32 – Archive (modified) files

  • 16384 – Drives

  • 32768 – Exclude read/write files
    from the list

To list several types, add the numbers associated with the
types. For example, to list read-write files, subdirectories, and
drives, use 0+16+16384 or 16400 for filetype.

statictext (optional)

The name of the StaticText in which you
want to display the current drive and directory.

Return Values

Boolean. Returns true if
the search path is valid so that the ListBox is populated or the
list is empty. DirList returns false if
the ListBox cannot be populated (for example, filespec is
a file, not a directory, or specifies an invalid path). If any argument’s
value is null, DirList returns null.

Usage

You can call DirList when the window opens
to populate the list initially. You should also call DirList in
the script for the SelectionChanged event to repopulate the list
box based on the new selection. (See the example in DirSelect.)

note.png Alternatives

Although DirList’s features allow
you to emulate the standard File Open and File Save windows, you
can get the full functionality of these standard windows by calling GetFileOpenName and GetFileSaveName instead
of DirList.

Examples

This statement populates the ListBox lb_emp with
a list of read/write files with the file extension TXT in
the search path C:EMPLOYEE*.TXT:

This statement populates the ListBox lb_emp with
a list of read-only files with the file extension DOC in
the search path C:EMPLOYEE*.DOC and
displays the path specification in the StaticText st_path:

These statements in the script for a window Open
event initialize a ListBox to all files in the current directory
that match *.TXT:

See Also


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x