Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

SftDirectoryFolder.Can Method

Tests whether the specified action is supported by the file/folder.

Syntax

VB.NETSupported = object.Can(ByVal Action As String) As Boolean
VBSupported = object.Can(ByVal Action As String) As Boolean
C#.NETbool Supported = object.Can(string Action);
VC++VARIANT_BOOL Supported = object->Can(_bstr_t Action);
CHRESULT object->raw_Can(BSTR Action, VARIANT_BOOL* Supported);

object

A SftDirectoryFolder object.

Action

A string defining the action to be tested. The string is case-sensitive and must be entered as shown here, without leading or trailing blanks. Some of the standard Action strings (implemented by Windows and Shell extensions) are:

ActionDescription
copyCopy a file/folder to the clipboard
openExecute program or open a file
exploreOpen a file/folder in a new window
cutCopy a file/folder to the clipboard and remove it
deleteRemove a file/folder
linkCreate a shortcut
moveMove a file/folder to another location
renameRename a file/folder
droptargetTests if a file/folder is a valid target for a drag & drop operation
pasteCopy the clipboard contents to the specified location
propertiesDisplay file/folder properties
NewFolderCreate a new folder

Supported

On return, specifies whether the specified action is supported by the file/folder.

SupportedDescription
TrueThe file/folder supports the specified action.
FalseThe file/folder doesn't support the specified action.

Comments

The Can method tests whether the specified action is supported by the file/folder.

Strings provided as Action parameter are Windows operating system specific and may be implemented by Shell extensions. Action parameters are not processed or implemented by SftDirectory, they are simply passed to the Windows Shell or Shell extensions.

The action can be executed using the Folder.Do method.

The Folder.Can method can be used to test one particular folder only. The control's Can method tests all currently selected folders.

Examples

VB.NET

Private Sub UpdateRightButtons()
    ' Update the buttons dependent on the right side detaillist
    Dim F As SftDirectoryFolder
    ' Enable/disable properties button
    F = AxSftDirectoryRight.CurrentFolder
    ButtonProp.Enabled = False
    If AxSftDirectoryRight.SelectionCount > 0 And Not F Is Nothing Then
        If F.Can("properties") Then
            ButtonProp.Enabled = True
        End If
    End If
    ' Enable/disable New Folder button
    ButtonNewFolder.Enabled = False
    F = AxSftDirectoryRight.RootFolder
    If Not F Is Nothing Then
        If F.Can("NewFolder") Then

VB6

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

C#

private void UpdateRightButtons()
{
    // Update the buttons dependent on the right side detaillist
    SftDirectoryFolder f;
    // Enable/disable properties button
    f = axSftDirectoryRight.CurrentFolder;
    buttonProp.Enabled = false;
    if (axSftDirectoryRight.SelectionCount > 0 && f != null) {
        if (f.Can("properties"))
            buttonProp.Enabled = true;
    }

    // Enable/disable New Folder button
    f = axSftDirectoryRight.RootFolder;
    buttonNewFolder.Enabled = false;
    if (f != null) {

C++

{
    ISftDirectoryPtr vDirRight = m_DirRight.GetControlUnknown();
    // Update the buttons dependent on the right side detaillist
    ISftDirectoryFolderPtr f;
    // Enable/disable properties button
    f = vDirRight->CurrentFolder;
    BOOL fEnable = FALSE;
    if (vDirRight->SelectionCount > 0 && f != NULL) {
        if (f->Can(_T("properties"))) {
            fEnable = TRUE;
        }
    }
    GetDlgItem(IDC_PROP_BUTTON)->EnableWindow(fEnable);

    // Enable/disable New Folder button
    fEnable = FALSE;

See Also SftDirectoryFolder Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.