Sixth chapter-Document management (iii) (5)

Source: Internet
Author: User
Tags create directory mkdir

6.4.6.3 change the type of display file

Changing the type of display file is in fact setting the Mask property of the filelist. We use a standard InputBox input file for matching strings. Then update the filelist with the Update method.

Procedure Tfmform.viewtype1click (Sender:tobject);

Var

filemask:string;

Begin

Filemask: = InputBox (' file type ', ' Input File type for View: ', filelist.mask);

If filemask = ' then filemask: = ' *.* ';

Filelist.mask: = Filemask;

Filelist.update;

Createcaption;

End

The createcaption private process is described in (6.4.8).

Implementation of 6.4.7 Directory management function

Directory management features are provided in the Directory menu of the child windows:

Create directory: Creating a subdirectory

Delete directory: Deletes an empty subdirectory

Change directory: Changing the current directory

6.4.7.1 Create a directory

A Tnewdir Type dialog box pops up first when creating a table of contents

The user is required to enter a directory name in the dialog box. If the user does not enter a path, the default is identified as a subdirectory of the current directory:

Dir: = Expandfilename (Dirname.text);

And then call the MkDir function. The I/O error detection was turned off during directory creation and the error does not cause an exception but sets the IOResult to a value other than 0. You can determine whether the creation was successful by checking whether IOResult is 0.

The list of procedures is as follows:

Procedure Tfmform.createdirectory1click (Sender:tobject);

Var

Newdir:tnewdir;

dir:string;

Begin

{$I-}

Newdir: = Tnewdir.create (self);

With Newdir do

Begin

Currentdir.caption: = directoryoutline.directory;

if (ShowModal <> idCancel) and (Dirname.text <> ") Then

Dir: = Expandfilename (Dirname.text);

End

MkDir (Dir);

If IOResult <> 0 Then

Messagedlg (' cannot Create directory ', mtwarning, [Mbok], 0);

End

Unfortunately, after the directory was created, we couldn't see it from the current directory tree. You must move to another drive and then return, and the directory you create is visible. We will provide a solution in the rear.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.