Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

SftDirectory.Column Property

Returns a SftDirectoryColumn object for a given contents value.

Syntax

Get

VB.NETrefColumnObj = object.get_Column(ByVal ColumnContents As SftDirectoryContentsConstants) As SftDirectoryColumn
VBSet refColumnObj = object.Column(ByVal ColumnContents As SftDirectoryContentsConstants) As SftDirectoryColumn
C#.NETSftDirectoryColumn refColumnObj = object.get_Column(SftDirectoryContentsConstants ColumnContents);
VC++ISftDirectoryColumn* refColumnObj = object->Column[enum SftDirectoryContentsConstants ColumnContents];
ISftDirectoryColumn* refColumnObj = object->GetColumn(enum SftDirectoryContentsConstants ColumnContents);
CHRESULT object->get_Column(enum SftDirectoryContentsConstants ColumnContents, ISftDirectoryColumn** refColumnObj);

object

A SftDirectory object.

ColumnContents

Defines the column contents for which a SftDirectoryColumn object should be returned.

ColumnContentsValueDescription
contentsSftDirectoryName0Name - Simple folder name.
contentsSftDirectorySize1Size - The file size, if available.
contentsSftDirectoryType2Type - The type of the folder as defined by the Windows Shell, if available.
contentsSftDirectoryDateMod3Date Modified - The date the folder was last modified, if available.
contentsSftDirectoryDateCre4Date Created - The date the folder was last modified, if available.
contentsSftDirectoryDateAcc5Date Accessed - The date the folder was last accessed, if available.
contentsSftDirectoryAttributes6Attributes - The attributes of the folder: 'A' - Folders ready to be archived, 'H' - hidden, 'C' - compressed, 'E' - encrypted folders.
contentsSftDirectoryUser151User defined 1 - User-defined contents are added while the control's contents are added using the UserContents event. If user-defined contents are added, the AutoInitialLoad property may need to be set to False.
contentsSftDirectoryUser252User defined 2.
contentsSftDirectoryUser353User defined 3.
contentsSftDirectoryUser454User defined 4.
contentsSftDirectoryUser555User defined 5.
contentsSftDirectoryUser656User defined 6.
contentsSftDirectoryUser757User defined 7.
contentsSftDirectoryUser858User defined 8.
contentsSftDirectoryUser959User defined 9.

refColumnObj

Returns a SftDirectoryColumn object for a given contents value.

Comments

The Column property returns a SftDirectoryColumn object for a given contents value.

Columns are managed by their contents value ColumnContents, rather than by their position. The column object SftDirectoryColumn is returned for the column containing the desired contents. If two columns have the same contents, the first column is returned. It is not possible to return the second column with identical contents.

The ColumnEntry property can be used to retrieve SftDirectoryColumn objects using the zero-based column number.

The AutoInitialLoad property may need to be set to False so the control does not load its contents immediately. This may be necessary if user-defined contents are added in certain columns. The UserContents event may not occur when the control is initially created, due to certain environment restrictions. For example, in Visual Basic, the UserContents event is not generated until the Form_Load event has occurred. The control however is created before the Form_Load event occurs, preventing the UserContents events from being handled by the application. This in effect prevents any user-defined contents from being added to the control. The solution is to set AutoInitialLoad to False and use the control's Reload method in the Form_Load event. Setting AutoInitialLoad to False isn't absolutely necessary, but it may save processing time as the control contents are only loaded once, in response to the Reload method.

Examples

VB.NET

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ' Displays all physical drives
    ' To avoid duplicate loading, use AutoInitialLoad = False in
    ' property page
    AxSftDirectory1.ControlStyle = SftDirectoryStyleConstants.styleSftDirectoryComboBoxDetailList
    AxSftDirectory1.TopMostFolderSpecial = SftDirectorySpecialFolderConstants.specialSftDirectoryMyComputer
    AxSftDirectory1.Headers.Style = SftDirectoryHeadersStyleConstants.headersSftDirectoryButton
    AxSftDirectory1.get_Column(SftDirectoryContentsConstants.contentsSftDirectoryName).HeaderText = "Drives"
End Sub

Private Sub AxSftDirectory1_Filtering(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_FilteringEvent) Handles AxSftDirectory1.Filtering
    ' This filters out folders such as "Shared Documents", "Control Panel", which
    ' are part of "My Computer"
    If e.folder.Type >= SftDirectoryFolderTypeConstants.typeSftDirectory_Computer_Drive35 And _
            e.folder.Type <= SftDirectoryFolderTypeConstants.typeSftDirectory_Computer_Other Then
        ' OK, add this to the control contents

VB6

Private Sub Form_Load()
    ' Displays all physical drives
    ' To avoid duplicate loading, use AutoInitialLoad = False in
    ' property page
    SftDirectory1.ControlStyle = styleSftDirectoryComboBoxDetailList
    SftDirectory1.TopMostFolderSpecial = specialSftDirectoryMyComputer
    SftDirectory1.Headers.Style = headersSftDirectoryButton
    SftDirectory1.Column(contentsSftDirectoryName).HeaderText = "Drives"
End Sub

Private Sub SftDirectory1_Filtering(Folder As SftDirectoryLib30.ISftDirectoryFolder, RemoveFolder As Boolean)
    ' This filters out folders such as "Shared Documents", "Control Panel", which
    ' are part of "My Computer"
    If Folder.Type >= typeSftDirectory_Computer_Drive35 And Folder.Type <= typeSftDirectory_Computer_Other Then
        ' OK, add this to the control contents
    Else

C#

private void Form1_Load(object sender, System.EventArgs e)
{
    // Displays all physical drives
    // To avoid duplicate loading, use AutoInitialLoad = False in
    // property page
    axSftDirectory1.ControlStyle = SftDirectoryStyleConstants.styleSftDirectoryComboBoxDetailList;
    axSftDirectory1.TopMostFolderSpecial = SftDirectorySpecialFolderConstants.specialSftDirectoryMyComputer;
    axSftDirectory1.Headers.Style = SftDirectoryHeadersStyleConstants.headersSftDirectoryButton;
    axSftDirectory1.get_Column(SftDirectoryContentsConstants.contentsSftDirectoryName).HeaderText = "Drives";
}

private void axSftDirectory1_Filtering(object sender, AxSftDirectoryLib30._ISftDirectoryEvents_FilteringEvent e)
{
    // This filters out folders such as "Shared Documents", "Control Panel", which
    // are part of "My Computer"
    if (e.folder.Type >= SftDirectoryFolderTypeConstants.typeSftDirectory_Computer_Drive35 &&

C++

    m_vDir1 = m_Dir1.GetControlUnknown();

    // Displays all physical drives
    // To avoid duplicate loading, use AutoInitialLoad = False in
    // property page
    m_vDir1->ControlStyle = styleSftDirectoryComboBoxDetailList;
    m_vDir1->TopMostFolderSpecial = specialSftDirectoryMyComputer;
    m_vDir1->Headers->Style = headersSftDirectoryButton;
    m_vDir1->Column[contentsSftDirectoryName]->HeaderText = "Drives";

    return TRUE;
}

void CFilteringDlg::OnFilteringSftDirectory1(LPDISPATCH FAR* Folder, BOOL FAR* RemoveFolder)
{
    ISftDirectoryFolderPtr pFolder(*Folder);

See Also SftDirectory Object | Object Hierarchy


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