Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

SftDirectory.KeyDown Event

A key is pressed.

Syntax

VB.NETPrivate Sub object_KeyDownEvent(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.KeyDownEvent
VBPrivate Sub object_KeyDown(KeyCode As Integer, ByVal Shift As Integer)
C#.NETvoid object_KeyDownEvent(object sender, EventArgumentType e);
VC++void OnKeyDownobject(short* KeyCode, short Shift);
CHRESULT OnKeyDownobject(short* KeyCode, short Shift);

object

A SftDirectory object.

KeyCode

Describes the virtual key pressed. See your development environment documentation for available key code constants.

Shift

Describes the state of the SHIFT, CONTROL and ALT keys. A bit is set if the key is down. The Shift argument is a bit field with bits corresponding to the SHIFT, CONTROL and ALT keys. It indicates the state of these keys. Some, all, or none of the bits can be set, indicating which of the keys are pressed.

ShiftValueDescription
constSftControlShiftMask1The SHIFT key is down.
constSftControlCtrlMask2The CONTROL key is down.
constSftControlAltMask4The ALT key is down.

Comments

The KeyDown event occurs when a key is pressed.

The KeyDown event is never generated for the TAB key.

To interpret keyboard characters (ANSI characters) use the KeyPress event.

The key typed by the user can be suppressed by setting KeyCode to 0.

Examples

VB.NET

    Dim F As SftDirectoryFolder
    F = AxSftDirectoryRight.RootFolder
    If Not F Is Nothing Then
        On Error Resume Next
        F.Do("NewFolder")
    End If
End Sub

Private Sub AxSftDirectoryLeft_KeyDownEvent(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_KeyDownEvent) Handles AxSftDirectoryLeft.KeyDownEvent
    ' F5 automatically reloads left side, but we also want right side updated
    If e.keyCode = Keys.F5 Then AxSftDirectoryRight.Reload(True, True)
End Sub

Private Sub AxSftDirectoryRight_KeyDownEvent(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_KeyDownEvent) Handles AxSftDirectoryRight.KeyDownEvent
    ' F5 automatically reloads right side, but we also want left side updated
    If e.keyCode = Keys.F5 Then AxSftDirectoryLeft.Reload(True, True)

VB6

    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

C#

    f = axSftDirectoryRight.RootFolder;
    if (f != null) {
        try {
            f.Do("NewFolder");
        } catch  
    }
}

private void axSftDirectoryLeft_KeyDownEvent(object sender, AxSftDirectoryLib30._ISftDirectoryEvents_KeyDownEvent e) {
    // F5 automatically reloads left side, but we also want right side updated
    if (e.keyCode == (short) Keys.F5) axSftDirectoryRight.Reload(true, true);
}

private void axSftDirectoryRight_KeyDownEvent(object sender, AxSftDirectoryLib30._ISftDirectoryEvents_KeyDownEvent e) {
    // F5 automatically reloads right side, but we also want left side updated
    if (e.keyCode == (short) Keys.F5) axSftDirectoryLeft.Reload(true, true);

C++

    // Create a new folder
    ISftDirectoryFolderPtr f;
    f = vDirRight->RootFolder;
    if (f != NULL) {
        f->Do("NewFolder");
    }
}

void CSimpleExplorerDlg::OnKeyDown_SftDirectoryLeft(short FAR* KeyCode, short Shift)
{
    // F5 automatically reloads left side, but we also want right side updated
    if (*KeyCode == VK_F5) {
        ISftDirectoryPtr vDirRight = m_DirRight.GetControlUnknown();
        vDirRight->Reload(VARIANT_TRUE, VARIANT_TRUE);
    }
}

See Also SftDirectory Object | Object Hierarchy


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