SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
This sample illustrates implementation of a simple Windows Explorer/File Explorer.
The source code is located at C:\Program Files (x86)\Softelvdm\SftDirectory 3.5\Samples\VB6\SimpleExplorer\Form1.frm or C:\Program Files\Softelvdm\SftDirectory 3.5\Samples\VB6\SimpleExplorer\Form1.frm (on 32-bit Windows versions).
Private Sub Form_Load() ' call this to update the buttons UpdateLeftButtons UpdateRightButtons SftDirectoryRight.MakeColumnsOptimal End Sub Private Sub SftDirectoryLeft_SelectionFinal() ' If the selection in the left tree changes, update right side detaillist UpdateLeftButtons SftDirectoryRight.Clear SftDirectoryRight.CancelMode SftDirectoryRight.Refresh If Not SftDirectoryLeft.CurrentFolder Is Nothing Then SftDirectoryRight.TopMostFolderIDL = SftDirectoryLeft.CurrentFolder.ItemIDList Else SftDirectoryRight.TopMostFolderSpecial = specialSftDirectoryEmpty End If End Sub Private Sub SftDirectoryRight_Opening(Folder As SftDirectoryLib30.ISftDirectoryFolder, Allow As Boolean) Dim F As SftDirectoryFolder Dim IDL As String ' we're about to open a file/folder. If we can add the folder on the ' left side, that means we don't need to open it in a separate window IDL = Folder.ItemIDList ' the folder we are looking for ' this will add the complete hierarchy down to the folder in ' left tree (if possible) On Error Resume Next Set F = SftDirectoryLeft.FolderUsingIDL(IDL, False) On Error GoTo 0 ' this will locate the exact item if we just added it Set F = SftDirectoryLeft.FolderUsingIDL(IDL, True) If Not F Is Nothing Then ' The folder has been added on the left side F.MakeCurrent ' make it the current item F.MakeVisible ' make sure it's scrolled into view Allow = False ' no need to open it End If End Sub Private Sub SftDirectoryRight_SelectionFinal() UpdateRightButtons End Sub Private Sub UpdateLeftButtons() ' Update the buttons dependent on the left tree Dim F As SftDirectoryFolder ' Enable/disable Up button Set F = SftDirectoryLeft.CurrentFolder If Not F Is Nothing Then Set F = F.Parent End If UpButton.Enabled = Not F Is Nothing End Sub Private Sub UpdateRightButtons() ' Update the buttons dependent on the right side detaillist Dim F As SftDirectoryFolder ' Enable/disable properties button Set F = SftDirectoryRight.CurrentFolder PropButton.Enabled = False If SftDirectoryRight.SelectionCount > 0 And Not F Is Nothing Then If F.Can("properties") Then PropButton.Enabled = True End If End If ' Enable/disable New Folder button Set F = SftDirectoryRight.RootFolder NewButton.Enabled = False If Not F Is Nothing Then If F.Can("NewFolder") Then NewButton.Enabled = True End If End If End Sub Private Sub UpButton_Click() ' Move up on level in left side tree control Dim F As SftDirectoryFolder Set F = SftDirectoryLeft.CurrentFolder If Not F Is Nothing Then Set F = F.Parent If Not F Is Nothing Then F.MakeCurrent ' make it the current item F.MakeVisible ' make sure it's scrolled into view End If End If End Sub Private Sub PropButton_Click() ' Display properties dialog for the currently selected item Dim F As SftDirectoryFolder Set F = SftDirectoryRight.CurrentFolder If SftDirectoryRight.SelectionCount > 0 And Not F Is Nothing Then F.Do "properties" End If End Sub Private Sub NewButton_Click() ' Create a new folder Dim F As SftDirectoryFolder Set F = SftDirectoryRight.RootFolder If Not F Is Nothing Then On Error Resume Next F.Do "NewFolder" End If End Sub Private Sub SftDirectoryLeft_KeyDown(KeyCode As Integer, ByVal Shift As Integer) ' F5 automatically reloads left side, but we also want right side updated If KeyCode = vbKeyF5 Then SftDirectoryRight.Reload True, True End Sub Private Sub SftDirectoryRight_KeyDown(KeyCode As Integer, ByVal Shift As Integer) ' F5 automatically reloads right side, but we also want left side updated If KeyCode = vbKeyF5 Then SftDirectoryLeft.Reload True, True End Sub