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.