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

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Data Dropdown"
  5.    ClientHeight    =   4815
  6.    ClientLeft      =   1155
  7.    ClientTop       =   1770
  8.    ClientWidth     =   6780
  9.    Height          =   5505
  10.    Icon            =   DROPDOWN.FRX:0000
  11.    Left            =   1095
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   4815
  14.    ScaleWidth      =   6780
  15.    Top             =   1140
  16.    Width           =   6900
  17.    Begin TrueGrid Table2 
  18.       AllowArrows     =   -1  'True
  19.       AllowTabs       =   -1  'True
  20.       DataSource      =   "Data2"
  21.       Editable        =   0   'False
  22.       EditDropDown    =   -1  'True
  23.       ExposeCellMode  =   0  'Expose upon selection
  24.       FetchMode       =   0  'By cell
  25.       HeadingHeight   =   1
  26.       Height          =   1935
  27.       HorzLines       =   0  'None
  28.       Layout          =   DROPDOWN.FRX:0302
  29.       Left            =   3675
  30.       LinesPerRow     =   1
  31.       MarqueeUnique   =   -1  'True
  32.       SplitPropsGlobal=   -1  'True
  33.       SplitTabMode    =   0  'Don't tab across splits
  34.       TabCapture      =   0   'False
  35.       TabIndex        =   1
  36.       Top             =   3000
  37.       UseBookmarks    =   -1  'True
  38.       Visible         =   0   'False
  39.       Width           =   3015
  40.       WrapCellPointer =   0   'False
  41.    End
  42.    Begin Data Data2 
  43.       Caption         =   "Data2"
  44.       Connect         =   ""
  45.       DatabaseName    =   "BIBLIO.MDB"
  46.       Exclusive       =   0   'False
  47.       Height          =   315
  48.       Left            =   1875
  49.       Options         =   0
  50.       ReadOnly        =   0   'False
  51.       RecordSource    =   "Authors"
  52.       Top             =   3000
  53.       Visible         =   0   'False
  54.       Width           =   1755
  55.    End
  56.    Begin Data Data1 
  57.       Caption         =   "Data1"
  58.       Connect         =   ""
  59.       DatabaseName    =   "BIBLIO.MDB"
  60.       Exclusive       =   0   'False
  61.       Height          =   315
  62.       Left            =   150
  63.       Options         =   0
  64.       ReadOnly        =   0   'False
  65.       RecordSource    =   "Titles"
  66.       Top             =   3000
  67.       Visible         =   0   'False
  68.       Width           =   1755
  69.    End
  70.    Begin TrueGrid Table1 
  71.       AllowArrows     =   -1  'True
  72.       AllowTabs       =   -1  'True
  73.       DataSource      =   "Data1"
  74.       Editable        =   -1  'True
  75.       EditDropDown    =   -1  'True
  76.       ExposeCellMode  =   0  'Expose upon selection
  77.       FetchMode       =   0  'By cell
  78.       HeadingHeight   =   1
  79.       Height          =   2835
  80.       HorzLines       =   0  'None
  81.       Layout          =   DROPDOWN.FRX:03A8
  82.       Left            =   75
  83.       LinesPerRow     =   1
  84.       MarqueeUnique   =   -1  'True
  85.       SplitPropsGlobal=   -1  'True
  86.       SplitTabMode    =   0  'Don't tab across splits
  87.       TabCapture      =   0   'False
  88.       TabIndex        =   0
  89.       Top             =   90
  90.       UseBookmarks    =   -1  'True
  91.       Width           =   6615
  92.       WrapCellPointer =   0   'False
  93.    End
  94.    Begin Label Label1 
  95.       Alignment       =   2  'Center
  96.       BackColor       =   &H00C0C0C0&
  97.       Caption         =   "Move to the Au_ID column, then click on the cell to pop-up the data dropdown for the column."
  98.       Height          =   495
  99.       Left            =   840
  100.       TabIndex        =   2
  101.       Top             =   3660
  102.       Width           =   4935
  103.    End
  104.    Begin Menu ExitOption 
  105.       Caption         =   "E&xit!"
  106.    End
  107.    Begin Menu HelpOption 
  108.       Caption         =   "&Help"
  109.       Begin Menu mHelpOption 
  110.          Caption         =   "&Index"
  111.          Index           =   1
  112.       End
  113.       Begin Menu mHelpOption 
  114.          Caption         =   "&Using Help"
  115.          Index           =   2
  116.       End
  117.       Begin Menu mHelpOption 
  118.          Caption         =   "-"
  119.          Index           =   3
  120.       End
  121.       Begin Menu mHelpOption 
  122.          Caption         =   "&About Data Dropdown..."
  123.          Index           =   4
  124.       End
  125.    End
  126. Sub CenterForm (F As Form)
  127. ' Center the specified form within the screen
  128.     F.Move (Screen.Width - F.Width) \ 2, (Screen.Height - F.Height) \ 2
  129. End Sub
  130. Sub ExitOption_Click ()
  131.     Unload Form1
  132. End Sub
  133. Sub Form_Load ()
  134.     Dim dbdir As String
  135.     'Set the DatabaseName of the Data controls
  136.     dbdir = App.Path
  137.     Data1.DatabaseName = dbdir + "\BIBLIO.MDB"
  138.     Data2.DatabaseName = dbdir + "\BIBLIO.MDB"
  139.     'Center the Form on the screen
  140.     CenterForm Form1
  141. End Sub
  142. Sub mHelpOption_Click (index As Integer)
  143.     'This event calls the WinHelp EXE and a location to goto based on which selection the user has chosen
  144.     'Case 4 shows the about box for Dropdown sample
  145.     Select Case index
  146.         Case 1
  147.             HelpContext Form1, HELP_DROPDOWN
  148.         Case 2
  149.             HelpOnHelp Form1
  150.         Case 4
  151.             About.Show 1
  152.     End Select
  153. End Sub
  154. Sub Table1_RequestEdit (Cancel As Integer, KeyAscii As Integer)
  155.     ' If they attempt to type in the cell, just let it happen
  156.     ' and don't pop up a dropdown.
  157.     If KeyAscii Then Exit Sub
  158.     ' Popup only for Au_ID
  159.     If Table1.ColumnName(Table1.ColumnIndex) <> "Au_ID" Then Exit Sub
  160.     ' Position the related data control to the proper row
  161.     Data2.Recordset.FindFirst "Au_ID = " & Table1.Text
  162.     ' Popup the dropdown
  163.     Table2.Top = Table1.CellRectTop + Table1.CellRectHeight
  164.     Table2.Left = Table1.CellRectLeft
  165.     Table2.Visible = True
  166.     Table2.SetFocus
  167.     ' Assure we don't go into edit mode
  168.     Cancel = True
  169. End Sub
  170. Sub Table2_DblClick ()
  171.     Table1.ColumnText(Table1.ColumnIndex) = Table2.ColumnText(1)
  172.     Table2.Visible = False
  173. End Sub
  174. Sub Table2_LostFocus ()
  175.     Table2.Visible = False
  176. End Sub
  177.