Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

EditInitialized Event, SftTree Object

Cell editing is about to start.

Syntax

VB.NETPrivate Sub object_EditInitialized(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.EditInitialized
VBPrivate Sub object_EditInitialized(ByVal Window As OLE_HANDLE, ByVal vData As Variant, ByVal EditIndex As Long, ByVal EditCol As Integer, ByVal ParentWindow As OLE_HANDLE, ByVal LeftPix As Long, ByVal TopPix As Long, ByVal WidthPix As Long, ByVal HeightPix As Long, Positioned As Boolean)
C#.NETvoid object_EditInitialized(object sender, EventArgumentType e);
VC++void OnEditInitializedobject(OLE_HANDLE Window, const _variant_t& vData, long EditIndex, short EditCol, OLE_HANDLE ParentWindow, long LeftPix, long TopPix, long WidthPix, long HeightPix, VARIANT_BOOL* Positioned);
CHRESULT OnEditInitializedobject(OLE_HANDLE Window, VARIANT vData, long EditIndex, short EditCol, OLE_HANDLE ParentWindow, long LeftPix, long TopPix, long WidthPix, long HeightPix, VARIANT_BOOL* Positioned);

object

A SftTree object.

Window

The window handle of the control being used for cell editing.

vData

Application-specific data provided as vData argument when Cell.Edit was called.

EditIndex

The zero-based index of the item being edited. The combination of EditIndex and EditCol describes an individual cell.

EditCol

The zero-based column number. The combination of EditIndex and EditCol describes an individual cell.

ParentWindow

The window handle of the window hosting the control used for cell editing.

LeftPix

The x coordinate of the control used for cell editing in pixels. This value was determined and returned by the EditInitializing event.

TopPix

The y coordinate of the control used for cell editing in pixels. This value was determined and returned by the EditInitializing event.

WidthPix

The width of the control used for cell editing in pixels. This value was determined and returned by the EditInitializing event.

HeightPix

The height of the control used for cell editing in pixels. This value was determined and returned by the EditInitializing event.

Positioned

Return True if the control used for cell editing was positioned by the application in the EditInitialized event. The application also must make the control visible, enabled and set the input focus to the control.

If False is returned, the tree control will position the control, enable the control, make it visible and set the input focus to the control.

Comments

The EditInitialized event occurs when cell editing is about to start.

Cell editing is about to start. The EditInitializing event, which precedes the EditInitialized event, has initialized a control for cell editing (described by the Window argument).

This event can be used to perform final control initialization. The control's position and dimension can be set, based on the LeftPix, TopPix, WidthPix, HeightPix arguments. The application also must make the control visible, enabled and set the input focus to the control. If Positioned is set to False, the tree control will automatically position the control used for cell editing, make the control visible, enabled and set the input focus to the control. However, many environments (including .NET) and ActiveX controls require that the application make controls visible and enabled explicitly.

Additional final customizations can be performed. For example, when a combo box is used, this event can drop down the dropdown portion of the edit control.

This event should not be used to otherwise initialize a control used for cell editing, nor should the tree control manipulated or updated in any way.

Examples

VB.NET

            ' We want these keys just for the edit control.
            ' VK_UP
            AxSftTree1.CellEditIntercept(38, SftTreeCellEditInterceptStyleConstants.cellEditInterceptSftTreeChar Or SftTreeCellEditInterceptStyleConstants.cellEditInterceptSftTreeControlChar Or SftTreeCellEditInterceptStyleConstants.cellEditInterceptSftTreeShiftChar)
            ' VK_DOWN
            AxSftTree1.CellEditIntercept(40, SftTreeCellEditInterceptStyleConstants.cellEditInterceptSftTreeChar Or SftTreeCellEditInterceptStyleConstants.cellEditInterceptSftTreeControlChar Or SftTreeCellEditInterceptStyleConstants.cellEditInterceptSftTreeShiftChar)
        End If
    End Sub

    Private Sub AxSftTree1_EditInitialized(ByVal sender As Object, ByVal e As AxSftTreeLib75._DSftTreeEvents_EditInitializedEvent) Handles AxSftTree1.EditInitialized
        ' Show the combo box dropdown portion
        If e.vData Is Combo1 Then
            ' We're taking over positioning, so we can drop down the dropdown portion of the control
            e.positioned = True
            Combo1.Left = e.leftPix
            Combo1.Top = e.topPix
            Combo1.Width = e.widthPix

VB6

        ' We want these keys just for the edit control.
        ' VK_UP
        SftTree1.CellEditIntercept 38, cellEditInterceptSftTreeChar + cellEditInterceptSftTreeControlChar + cellEditInterceptSftTreeShiftChar
        ' VK_DOWN
        SftTree1.CellEditIntercept 40, cellEditInterceptSftTreeChar + cellEditInterceptSftTreeControlChar + cellEditInterceptSftTreeShiftChar
    End If
End Sub

Private Sub SftTree1_EditInitialized(ByVal Window As stdole.OLE_HANDLE, ByVal vData As Variant, ByVal EditIndex As Long, ByVal EditCol As Integer, ByVal ParentWindow As stdole.OLE_HANDLE, ByVal LeftPix As Long, ByVal TopPix As Long, ByVal WidthPix As Long, ByVal HeightPix As Long, Positioned As Boolean)
    ' Show the combo box dropdown portion
    If Window = Combo1.hwnd Then
        ' We're taking over positioning, so we can drop down the dropdown portion of the control
        Positioned = True
        Combo1.Left = LeftPix * Screen.TwipsPerPixelX
        Combo1.Top = TopPix * Screen.TwipsPerPixelY
        Combo1.Width = WidthPix * Screen.TwipsPerPixelX

C#

                // We want these keys just for the edit control.
                // VK_UP
                axSftTree1.CellEditIntercept(38, SftTreeCellEditInterceptStyleConstants.cellEditInterceptSftTreeChar | SftTreeCellEditInterceptStyleConstants.cellEditInterceptSftTreeControlChar | SftTreeCellEditInterceptStyleConstants.cellEditInterceptSftTreeShiftChar);
                // VK_DOWN
                axSftTree1.CellEditIntercept(40, SftTreeCellEditInterceptStyleConstants.cellEditInterceptSftTreeChar | SftTreeCellEditInterceptStyleConstants.cellEditInterceptSftTreeControlChar | SftTreeCellEditInterceptStyleConstants.cellEditInterceptSftTreeShiftChar);
            }
        }

        private void axSftTree1_EditInitialized(object sender, AxSftTreeLib75._DSftTreeEvents_EditInitializedEvent e) {
            // Show the combo box dropdown portion
            if (e.vData == Combo1) {
                // We're taking over positioning, so we can drop down the dropdown portion of the control
                e.positioned = true;
                Combo1.Left = e.leftPix;
                Combo1.Top = e.topPix;
                Combo1.Width = e.widthPix;

C++

        // We want these keys just for the edit control.
        // VK_UP
        m_vTree->CellEditIntercept(VK_UP, (SftTreeCellEditInterceptStyleConstants) (cellEditInterceptSftTreeChar | cellEditInterceptSftTreeControlChar | cellEditInterceptSftTreeShiftChar));
        // VK_DOWN
        m_vTree->CellEditIntercept(VK_DOWN, (SftTreeCellEditInterceptStyleConstants) (cellEditInterceptSftTreeChar | cellEditInterceptSftTreeControlChar | cellEditInterceptSftTreeShiftChar));
    }
}

void CCellEditingDlg::OnEditInitializedSftTree1(long Window, const VARIANT FAR& vData, long EditIndex, short EditCol, long ParentWindow, long LeftPix, long TopPix, long WidthPix, long HeightPix, BOOL FAR* Positioned)
{
    // Show the combo box dropdown portion
    if ((HWND)Window == m_Combo1.m_hWnd) {
        // We're taking over positioning, so we can drop down the dropdown portion of the control
        *Positioned = VARIANT_TRUE;
        m_Combo1.MoveWindow(LeftPix, TopPix, WidthPix, HeightPix, TRUE);
        m_Combo1.EnableWindow();

See Also SftTree Object | Object Hierarchy


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