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
An OLE drag & drop event indicating something has been dropped over the tree control.
VB.NET | Private Sub object_OLEDragDrop(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.OLEDragDrop |
VB | Private Sub object_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single) |
C#.NET | void object_OLEDragDrop(object sender, EventArgumentType e); |
VC++ | void OnOLEDragDropobject(struct IVDMDataObject** Data, long* Effect, short* Button, short* Shift, float* x, float* y); |
C | HRESULT OnOLEDragDropobject(struct IVDMDataObject** Data, long* Effect, short* Button, short* Shift, float* x, float* y); |
object
Data
A DataObject object containing formats that the source will provide and, in addition, possibly the data for those formats. If no data is contained in the DataObject, it is provided when the control calls the DataObject.GetData method. The DataObject.SetData and DataObject.Clear methods cannot be used here.
Effect
Set by the target component identifying the action that has been performed (if any), thus allowing the source to take appropriate action if the component was moved (such as the source deleting the data).
Effect | Value | Description |
---|---|---|
vbDropEffectNone | 0 | Drop target cannot accept the data. |
vbDropEffectCopy | 1 | Drop results in a copy of data from the source to the target. The original data is unaltered by the drag operation. |
vbDropEffectMove | 2 | Drop results in data being moved from the drag source to the drop source. The drag source should remove the data from itself after the move. |
Note: Only Visual Basic offers the predefined constants vbDropEffectNone, etc. When using other languages, the constants have to be defined explicitly by the application.
Button
The button that is pressed during the event (see SftTreeButtonConstants). The button argument is a bit field with bits corresponding to the left button, right button and middle button. These bits correspond to the values shown below. Only one of the bits is set, indicating the button that caused the event.
Button | Value | Description |
---|---|---|
constSftTreeLeftButton | 1 | The left mouse button was pressed. |
constSftTreeRightButton | 2 | The right mouse button was pressed. |
constSftTreeMiddleButton | 4 | The middle mouse button was pressed. |
Shift
The state of the SHIFT, CONTROL and ALT keys during the event (see SftTreeKeyConstants). 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. The Shift variable indicates the state of these keys. Some, all, or none of the bits can be set, indicating which of the keys are pressed.
Shift | Value | Description |
---|---|---|
constSftTreeShiftMask | 1 | The SHIFT key was pressed. |
constSftTreeCtrlMask | 2 | The CONTROL key was pressed. |
constSftTreeAltMask | 4 | The ALT key was pressed. |
x
The x coordinate of the mouse cursor.
y
The y coordinate of the mouse cursor.
The OLEDragDrop event occurs indicating something has been dropped over the tree control.
The OLEDragDrop event only occurs if the OLEDropMode property is set to OLEDropSftTreeManual.
The source control should always mask values from the Effect parameter to ensure compatibility with future implementations of drag & drop. Presently, only three bits in the Effect parameter are used. In future versions other bits may be used. As a precaution against future problems, drag sources and drop targets should mask these values appropriately before performing any comparisons.
For example, a source component should not compare an Effect against, for example, vbDropEffectCopy, such as:
If Effect = vbDropEffectCopy...
Instead, the source component should mask the value or values being sought, as here:
If Effect And vbDropEffectCopy = vbDropEffectCopy...
-or-
If (Effect And vbDropEffectCopy)...
This allows for the definition of new drop effects in future versions while preserving compatibility with your existing code.
Private Sub DropTargetPic_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles DropTargetPic.DragDrop Dim arrayOfFormats As [String]() = e.Data.GetFormats(True) ' informational If e.Data.GetDataPresent(DataFormats.Bitmap, True) Then Dim O As Object = e.Data.GetData(DataFormats.Bitmap, True) DropTargetPic.Image = O End If End Sub Private Sub AxSftTree1_OLEDragDrop(ByVal sender As Object, ByVal e As AxSftTreeLib75._DSftTreeEvents_OLEDragDropEvent) Handles AxSftTree1.OLEDragDrop ' get horizontal extent and width of column 0 Dim horzExtent As Integer horzExtent = AxSftTree1.Items.HorizontalExtentPix Dim firstColumnWidth As Integer firstColumnWidth = AxSftTree1.get_Column(0).WidthPix Dim insertAt As Integer
ElseIf SftTree1.Item(curr).DependentAllCount > 0 Then Data.SetData SftTree1.Items.ItemImageExpandable.Picture, vbCFDIB Else Data.SetData SftTree1.Items.ItemImageLeaf.Picture, vbCFDIB End If End If End Sub Private Sub SftTree1_OLEDragDrop(Data As SftTreeLib75.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single) Dim insertAt As Integer Dim str As String Dim lvl As Integer, newItem As Integer Dim horzExtent As Single, col0Width As Single ' get horizontal extent and width of column 0 horzExtent = SftTree1.Items.HorizontalExtent
private void DropTargetPic_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { String[] arrayOfFormats = e.Data.GetFormats(true); // informational if (e.Data.GetDataPresent(DataFormats.Bitmap, true)) { object o = e.Data.GetData(DataFormats.Bitmap, true); DropTargetPic.Image = (Image) o; } } private void axSftTree1_OLEDragDrop(object sender, AxSftTreeLib75._DSftTreeEvents_OLEDragDropEvent e) { // get horizontal extent and width of column 0 int horzExtent = axSftTree1.Items.HorizontalExtentPix; int firstColumnWidth = axSftTree1.get_Column(0).WidthPix; int insertAt = axSftTree1.Items.DropHighlight; if (insertAt < 0) return;
pDataObject->SetData(_variant_t(m_vTree->Items->ItemImageExpanded->GetPicture(), _variant_t((short)sftCFDIB))); else if (m_vTree->Item[curr]->DependentAllCount > 0) pDataObject->SetData(_variant_t(m_vTree->Items->ItemImageExpandable->GetPicture(), _variant_t((short)sftCFDIB))); else pDataObject->SetData(_variant_t(m_vTree->Items->ItemImageLeaf->GetPicture(), _variant_t((short)sftCFDIB))); } } void CDragDropDlg::OnOLEDragDropSftTree(LPDISPATCH FAR* Data, long FAR* Effect, short FAR* Button, short FAR* Shift, float FAR* x, float FAR* y) { IVDMDataObjectPtr pDataObject = *Data; ASSERT(pDataObject != NULL); // get horizontal extent and width of column 0 long horzExtent = m_vTree->Items->HorizontalExtentPix; long col0Width = m_vTree->Column[0]->WidthPix;
See Also SftTree Object | Object Hierarchy