home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / outlndrg / otln_drg.frm next >
Text File  |  1994-04-06  |  2KB  |  75 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Sample of Dragging from the Outline control to a List box"
  4.    ClientHeight    =   4020
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1485
  7.    ClientWidth     =   7365
  8.    Height          =   4425
  9.    Left            =   1035
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4020
  12.    ScaleWidth      =   7365
  13.    Top             =   1140
  14.    Width           =   7485
  15.    Begin ListBox List1 
  16.       Height          =   1590
  17.       Left            =   4440
  18.       TabIndex        =   1
  19.       Top             =   960
  20.       Width           =   1815
  21.    End
  22.    Begin Outline Outline1 
  23.       Height          =   2295
  24.       Left            =   1320
  25.       PictureClosed   =   OTLN_DRG.FRX:0000
  26.       PictureLeaf     =   OTLN_DRG.FRX:015A
  27.       PictureMinus    =   OTLN_DRG.FRX:02B4
  28.       PictureOpen     =   OTLN_DRG.FRX:040E
  29.       PicturePlus     =   OTLN_DRG.FRX:0568
  30.       Style           =   2  'Plus/Minus and Text
  31.       TabIndex        =   0
  32.       Top             =   720
  33.       Width           =   2415
  34.    End
  35.    Begin Label Label1 
  36.       Caption         =   "This sample is designed to only allow the folders that don't have subitems to be dropped in the List box control."
  37.       Height          =   375
  38.       Left            =   1320
  39.       TabIndex        =   2
  40.       Top             =   120
  41.       Width           =   5055
  42.    End
  43. End
  44.  
  45. Sub Form_Load ()
  46.      For i = 0 To 4
  47.          ' Note that item 0 will not be visible, by design.
  48.          outline1.AddItem "Item # " + Str$(i)
  49.          outline1.Indent(i) = i
  50.       Next
  51.       For i = 1 To 4
  52.          outline1.Expand(i - 1) = True
  53.       Next
  54.       ' Add the following statement to work around a known bug
  55.        outline1.ListIndex = 1
  56.  
  57. End Sub
  58.  
  59. Sub List1_DragDrop (Source As Control, X As Single, Y As Single)
  60. outline1.Drag 0
  61.  
  62. If outline1.HasSubItems(outline1.ListIndex) = False Then  'no parents, only leaves
  63.  list1.AddItem outline1.List(outline1.ListIndex)
  64. Else
  65.  MsgBox "Sorry this folder has a subitem"
  66. End If
  67.  
  68. End Sub
  69.  
  70. Sub Outline1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  71.  outline1.Drag 1
  72.  
  73. End Sub
  74.  
  75.