The DirView (gb.form) control is a (specialised) TreeView that displays directories and their subdirectories according to a directory icon with the corresponding directory name.
The path to the selected directory is returned in the Current property.
Figure 6.9.2.1: DirView with display of the selected directory in a label.
The control can be created:
Dim hDirView As DirView hDirView = New DirView ( Parent As Container ) As "EventName"
The DirView class has the following properties:
Property | Data type | Description |
---|---|---|
Current | String | Returns the selected, highlighted directory in the DirView. |
HideRoot | Boolean | Returns False if the root directory is visible or sets the value for visibility. |
Picture | Picture | Returns the picture that is displayed in front of the root directory or sets the picture. |
Renaming | Boolean | Returns True if a directory is renamed. |
Settings | Variant[ ] | Returns or assigns the configuration of the DirView. The configuration is stored in a Variant array in an unspecified format. Note: Since the Settings property serves as an interface to the gb.settings component, which allows graphical controls to serialise and re-read their own state, you should refrain from using this property. |
ShowHidden | Boolean | Returns True if the directories are hidden or sets the value for their visibility. |
Table 6.9.2.1.1 : Properties of the DirView class
The DirView class has these methods, among others:
Method | Description |
---|---|
NewFolder( ) | Starts the creation of a new directory within the current (selected) directory. The process can be cancelled with ESC. If the name of the new directory to be created already exists, then after an error message 'Directory cannot be renamed. File already exists' a new directory with the name 'New Directory' will be created! |
Reload( ) | Updates the content of the view. |
Rename( ) | Starts the renaming of the current (selected) directory. The process can be cancelled with ESC. If the new name of the directory already exists, then after an error message 'Directory cannot be renamed. File already exists' the old name is kept. |
Table 6.9.2.2.1 : Methods of the DirView class
The following table describes selected events of the DirView class:
Event | Description |
---|---|
Activate() | This event is triggered when a directory in the DirView is double clicked. |
Icon(Path As String) | This event is fired when the control needs to get the icon for a specific file or directory. Path is the file path. |
Menu() | This event is triggered when the user requests a pop-up menu. |
Select() | This event is triggered when the user selects a directory. |
Table 6.9.2.3.1 : Selected properties of the DirView class.
Notes:
The DirView control has no context menu.
Project