Please enable JavaScript to view this site.

KOL/MCK - User Guide

Sometimes the slowness of opening the standard dialog for choosing a directory becomes annoying. But even that is not the main reason why I finally (most recently) made my own dialogue for this purpose. The main reason is the incorrect display of the directory tree (simply, the "glitchiness" of the system dialogue).

 

For example, a dialog starts to open, and a certain directory is selected in the tree by default. And the parent folder for this directory only shows this subordinate folder, and flatly refuses to show its other children. In addition, I do not really understand the intention of the Microsoft programmers, who designed this dialog in such a way that, by default, the focus is not on the folder tree, but on the OK button. As if this dialog is needed only for the user to confirm the choice of the directory that the program offers him.

 

Further, the ability to create directories for selection in the directory selection process is potentially a very good feature. But how absurdly it is implemented! After creating the directory and renaming it, the line "New Folder" remains in the input field. In order to still select the newly created directory, you have to do additional manipulations. It would have been better then this opportunity had not existed at all. [Ed. 2010: This item appears to have been fixed in Windows 7 - have you really read the book about KOL?]

 

And again, speed. Why recalculate the entire tree of folders from disk every time, if the dialog can be hidden after the first call, and quickly shown again on the screen after repeated calls? After all, it saves a lot of time and nerves.

 

Disadvantages of my alternate dialog:

everything is done by its own code, i.e. the size of the application is larger (by how much it depends on whether the same objects are used elsewhere in the program code);

there is no way to create a new directory during the selection process;

the alternative dialog is not intended and cannot be used to search for a computer, printer, or network folders if they are not connected as virtual drives with their own device letters.

 

Everything else I would attribute to the benefits. For example, the size and position of the dialog box can be easily controlled from the application. You can add your own elements to the form (including ensuring the creation of a new folder, if required). And most importantly, the speed of reopening is almost instantaneous (and for the first time there are fewer "brakes", forgive me this vernacular expression).

 

Note; Starting with version 3.00, this useful property of fast folder tree building has been "compounded" by the transition to directory scanning by UNICODE versions of API functions that perform file enumeration. Of course, these versions of the functions are only used on their respective NT-based operating systems.

 

The TOpenDirDialogEx object type is implemented in a separate module KOLDirDlgEx.pas. Its constructor:

 

NewOpenDirDialogEx - does not require parameters.

 

Methods and properties:

 

Execute - a method for displaying the dialog form on the screen in the modal window mode, until the user closes the dialog, or until a directory is selected from the folder tree;

InitialPath - the directory from which the dialogue starts;

Path - folder selected by the user (in case of successful completion of the dialogue);

Form - pointer to the PControl window object, which is a dialog form. You can customize this shape (color, size, and other parameters), attach any handlers to it, add your own or change existing elements - before calling the dialog, at your discretion. For the composition of the form, see the CreateDialogForm method in the implementation part, where it is generated dynamically;

Title - the title of the dialogue form;

OKCaption - the title of the OK button. By default, the string is 'OK';

CancelCaption - the title of the Cancel button. By default 'Cancel';

FilterAttrs - a set of file attributes for a directory filter. This field allows you to determine whether to give the ability to select system and hidden folders - if necessary (enabling the corresponding attribute value excludes directories with this attribute from viewing);

FilterRecycled - setting this property to true excludes the folder for "deleted" files from the list of displayed files, regardless of its name on this computer (Recycled Bin, Recycle Bin, etc.).

 

AltDirDialog
In addition, a link bar can be added to the extended folder selection dialog. To do this, add the conditional compilation symbol DIRDLGEX_LINKSPANEL and set the LinksPanelOn property to TRUE. But that's not enough if only youdo not intend to force the user to fill the left panel of the dialog with links again in each session of the application. You should use the CollectLinks function at the end of the work to get a list of links selected by the user in the left panel, after which you can save it in a way convenient for you - in the registry, ini-file, or something else, so that it can be downloaded and used on subsequent launches of the program. To programmatically add links to the left pane, use calls to the AddLinks method. In addition, in the process of work, properties with self-explanatory names are available:

Links [] - list of links;

LinksCount - the number of links;

LinkPresent[] - checks for a link with the specified path to the folder,

as well as methods:

RemoveLink (lnk) - removes the link to the folder with the specified path;

ClearLinks - clears the list of links.

 

For this object, I decided not to make a separate mirror in MCK, but to use the existing mirror component TKOLOpendirDialog, adding only the design-time property AltDialog. This property allows you to instantly "turn" a standard dialogue into an alternative one, and vice versa.

 

But the composition of the properties used to customize the dialog at the design stage of the form does not change. For the alternative dialog, the MCK generates a code that takes into account only those properties that coincide with the properties of the standard dialog (in this case, properties that are not "inherent" to the alternative dialog are ignored). Changing other settings of the alternative dialog, specific only to it, must be done by your code, during the execution of the application.

 

 

KOL / MCK User Guide - Created by Carl Peeraer - Diamant Soft, based on the work of Vladimir Kladov - Artwerp.be

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Nav Header: ALT+n
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Exit Menu/Up: ESC