home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / truegrid / disk1 / dragdrop / dragdrop.$ / DRAGDROP.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-02-17  |  6.9 KB  |  201 lines

  1. VERSION 2.00
  2. Begin Form Main 
  3.    Caption         =   "Drag and Drop Sample"
  4.    ClientHeight    =   4545
  5.    ClientLeft      =   1005
  6.    ClientTop       =   1740
  7.    ClientWidth     =   7305
  8.    Height          =   5235
  9.    Icon            =   DRAGDROP.FRX:0000
  10.    Left            =   945
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4545
  13.    ScaleWidth      =   7305
  14.    Top             =   1110
  15.    Width           =   7425
  16.    Begin TrueGrid Table2 
  17.       AllowArrows     =   -1  'True
  18.       AllowTabs       =   -1  'True
  19.       BackColor       =   &H00C0C0C0&
  20.       DataSource      =   "Data2"
  21.       Editable        =   -1  'True
  22.       EditDropDown    =   -1  'True
  23.       ExposeCellMode  =   0  'Expose upon selection
  24.       FetchMode       =   0  'By cell
  25.       FontBold        =   0   'False
  26.       FontItalic      =   0   'False
  27.       FontName        =   "MS Sans Serif"
  28.       FontSize        =   8.25
  29.       FontStrikethru  =   0   'False
  30.       FontUnderline   =   0   'False
  31.       HeadingHeight   =   1.37
  32.       Height          =   2055
  33.       HorzLines       =   0  'None
  34.       Layout          =   DRAGDROP.FRX:0302
  35.       Left            =   120
  36.       LinesPerRow     =   1
  37.       MarqueeUnique   =   -1  'True
  38.       SplitPropsGlobal=   -1  'True
  39.       SplitTabMode    =   0  'Don't tab across splits
  40.       TabCapture      =   0   'False
  41.       TabIndex        =   1
  42.       Top             =   2340
  43.       UseBookmarks    =   -1  'True
  44.       Width           =   7035
  45.       WrapCellPointer =   0   'False
  46.    End
  47.    Begin Data Data2 
  48.       Caption         =   "Data2"
  49.       Connect         =   ""
  50.       DatabaseName    =   "C:\DEV\TGTIPS\TASKS.MDB"
  51.       Exclusive       =   0   'False
  52.       Height          =   315
  53.       Left            =   2130
  54.       Options         =   0
  55.       ReadOnly        =   0   'False
  56.       RecordSource    =   "Projects"
  57.       Top             =   4380
  58.       Visible         =   0   'False
  59.       Width           =   1755
  60.    End
  61.    Begin TrueGrid Table1 
  62.       AllowArrows     =   -1  'True
  63.       AllowTabs       =   -1  'True
  64.       BackColor       =   &H00C0C0C0&
  65.       DataSource      =   "Data1"
  66.       DragIcon        =   DRAGDROP.FRX:03DF
  67.       Editable        =   -1  'True
  68.       EditDropDown    =   -1  'True
  69.       ExposeCellMode  =   0  'Expose upon selection
  70.       FetchMode       =   0  'By cell
  71.       HeadingHeight   =   1.37
  72.       Height          =   2115
  73.       HorzLines       =   0  'None
  74.       Layout          =   DRAGDROP.FRX:06E1
  75.       Left            =   120
  76.       LinesPerRow     =   1
  77.       MarqueeUnique   =   -1  'True
  78.       SplitPropsGlobal=   -1  'True
  79.       SplitTabMode    =   0  'Don't tab across splits
  80.       TabCapture      =   0   'False
  81.       TabIndex        =   0
  82.       Top             =   120
  83.       UseBookmarks    =   -1  'True
  84.       Width           =   7035
  85.       WrapCellPointer =   0   'False
  86.    End
  87.    Begin Data Data1 
  88.       Caption         =   "Data1"
  89.       Connect         =   ""
  90.       DatabaseName    =   "C:\DEV\TGTIPS\PHONE.MDB"
  91.       Exclusive       =   0   'False
  92.       Height          =   315
  93.       Left            =   180
  94.       Options         =   0
  95.       ReadOnly        =   0   'False
  96.       RecordSource    =   "PhoneList"
  97.       Top             =   4380
  98.       Visible         =   0   'False
  99.       Width           =   1755
  100.    End
  101.    Begin Menu ExitMenuOption 
  102.       Caption         =   "E&xit!"
  103.    End
  104.    Begin Menu HelpMenuOption 
  105.       Caption         =   "&Help"
  106.       Begin Menu mHelpOption 
  107.          Caption         =   "&Index"
  108.          Index           =   1
  109.       End
  110.       Begin Menu mHelpOption 
  111.          Caption         =   "&Using Help"
  112.          Index           =   2
  113.       End
  114.       Begin Menu mHelpOption 
  115.          Caption         =   "-"
  116.          Index           =   3
  117.       End
  118.       Begin Menu mHelpOption 
  119.          Caption         =   "&About Drag and Drop..."
  120.          Index           =   4
  121.       End
  122.    End
  123. ' ---------------------------------------------------------
  124. '       Copyright (C) 1993 Apex Software Corporation
  125. ' You have a royalty-free right to use, modify, reproduce,
  126. ' and distribute the True Grid sample application files
  127. ' (and/or any modified version) in any way you find useful,
  128. ' provided that you agree that Apex Software Corporation
  129. ' has no warranty, obligations, or liability for any sample
  130. ' application files.
  131. ' ---------------------------------------------------------
  132. Sub CenterForm (F As Form)
  133.     ' Center the specified form within the screen
  134.     F.Move (Screen.Width - F.Width) \ 2, (Screen.Height - F.Height) \ 2
  135. End Sub
  136. Sub ExitMenuOption_Click ()
  137.     Unload Main
  138.     End
  139. End Sub
  140. Sub Form_Load ()
  141.     Dim dbdir As String
  142.     'Set the databasename property of the data controls
  143.     dbdir = App.Path
  144.     Data1.DatabaseName = dbdir + "\phone.mdb"
  145.     Data2.DatabaseName = dbdir + "\tasks.mdb"
  146.     'Centers the form on the screen
  147.     CenterForm Main
  148. End Sub
  149. Sub mHelpOption_Click (index As Integer)
  150.     'This event calls the WinHelp EXE and a location to goto based on which selection the user has chosen
  151.     'Case 4 shows the about box for True Browser
  152.     Select Case index
  153.         Case 1
  154.             HelpContext Main, HELP_DRAGDROP
  155.         Case 2
  156.             HelpOnHelp Main
  157.         Case 4
  158.             About.Show 1
  159.     End Select
  160. End Sub
  161. Sub Table1_DragCell (Split As Integer, Row As Long, Col As Integer)
  162.     ' Begin dragging the cell we've pointed to.  In this case
  163.     ' we only want to drag if the mouse is positioned over the
  164.     ' second row.
  165.     If Col = 2 Then
  166.         Table1.RowIndex = Row
  167.         Table1.ColumnIndex = Col
  168.         Table1.Drag 1
  169.     End If
  170. End Sub
  171. Sub Table2_Append ()
  172.     ' Add a new project
  173.     If MsgBox("Add a new project?", 1) = 2 Then Exit Sub
  174.     Data2.Recordset.AddNew
  175.     Data2.Recordset("Project") = "New..."
  176. End Sub
  177. Sub Table2_DragDrop (Source As Control, X As Single, Y As Single)
  178.     ' We always take the person's name and
  179.     ' phone number from the first grid and
  180.     ' drop it into the proper cells in the
  181.     ' second grid , but we really can do anything
  182.     ' we want here.
  183.     ' Ask if user wants to replace current manager
  184.     If Table2.ColumnText(Table2.ColumnIndex) <> "" Then
  185.         ret% = MsgBox("Are you sure you want to replace current manager?", 1, "Warning")
  186.         If ret% = 2 Then
  187.             Exit Sub
  188.         End If
  189.     End If
  190.     Table2.ColumnText(2) = Table1.ColumnText(2)
  191.     Table2.ColumnText(3) = Table1.ColumnText(3)
  192.     Data2.Recordset.Update
  193. End Sub
  194. Sub Table2_DragOver (Source As Control, X As Single, Y As Single, state As Integer)
  195.     ' Set the cell to the one we're pointing at
  196.     Table2.PointX = X
  197.     Table2.PointY = Y
  198.     If Table2.RowAtPoint > 0 Then Table2.RowIndex = Table2.RowAtPoint
  199.     If Table2.ColumnAtPoint Then Table2.ColumnIndex = Table2.ColumnAtPoint
  200. End Sub
  201.