home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
vb_code1
/
outlndrg
/
otln_drg.frm
next >
Wrap
Text File
|
1994-04-06
|
2KB
|
75 lines
VERSION 2.00
Begin Form Form1
Caption = "Sample of Dragging from the Outline control to a List box"
ClientHeight = 4020
ClientLeft = 1095
ClientTop = 1485
ClientWidth = 7365
Height = 4425
Left = 1035
LinkTopic = "Form1"
ScaleHeight = 4020
ScaleWidth = 7365
Top = 1140
Width = 7485
Begin ListBox List1
Height = 1590
Left = 4440
TabIndex = 1
Top = 960
Width = 1815
End
Begin Outline Outline1
Height = 2295
Left = 1320
PictureClosed = OTLN_DRG.FRX:0000
PictureLeaf = OTLN_DRG.FRX:015A
PictureMinus = OTLN_DRG.FRX:02B4
PictureOpen = OTLN_DRG.FRX:040E
PicturePlus = OTLN_DRG.FRX:0568
Style = 2 'Plus/Minus and Text
TabIndex = 0
Top = 720
Width = 2415
End
Begin Label Label1
Caption = "This sample is designed to only allow the folders that don't have subitems to be dropped in the List box control."
Height = 375
Left = 1320
TabIndex = 2
Top = 120
Width = 5055
End
End
Sub Form_Load ()
For i = 0 To 4
' Note that item 0 will not be visible, by design.
outline1.AddItem "Item # " + Str$(i)
outline1.Indent(i) = i
Next
For i = 1 To 4
outline1.Expand(i - 1) = True
Next
' Add the following statement to work around a known bug
outline1.ListIndex = 1
End Sub
Sub List1_DragDrop (Source As Control, X As Single, Y As Single)
outline1.Drag 0
If outline1.HasSubItems(outline1.ListIndex) = False Then 'no parents, only leaves
list1.AddItem outline1.List(outline1.ListIndex)
Else
MsgBox "Sorry this folder has a subitem"
End If
End Sub
Sub Outline1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
outline1.Drag 1
End Sub