home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Basic / Samples / VB_SMPL / VB_SMPL.ZIP / OUTLNDRG.EXE / OTLN_DRG.FRM (.txt) next >
Encoding:
Visual Basic Form  |  1994-04-06  |  2.2 KB  |  65 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. Sub Form_Load ()
  44.      For i = 0 To 4
  45.          ' Note that item 0 will not be visible, by design.
  46.          outline1.AddItem "Item # " + Str$(i)
  47.          outline1.Indent(i) = i
  48.       Next
  49.       For i = 1 To 4
  50.          outline1.Expand(i - 1) = True
  51.       Next
  52.       ' Add the following statement to work around a known bug
  53.        outline1.ListIndex = 1
  54. End Sub
  55. Sub List1_DragDrop (Source As Control, X As Single, Y As Single)
  56. outline1.Drag 0
  57. If outline1.HasSubItems(outline1.ListIndex) = False Then  'no parents, only leaves
  58.  list1.AddItem outline1.List(outline1.ListIndex)
  59.  MsgBox "Sorry this folder has a subitem"
  60. End If
  61. End Sub
  62. Sub Outline1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  63.  outline1.Drag 1
  64. End Sub
  65.