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

  1. VERSION 2.00
  2. Begin Form CountryFrm 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "In-Cell Graphic Sample"
  5.    ClientHeight    =   3900
  6.    ClientLeft      =   1695
  7.    ClientTop       =   2235
  8.    ClientWidth     =   8160
  9.    Height          =   4590
  10.    Icon            =   COUNTRY.FRX:0000
  11.    Left            =   1635
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   3900
  14.    ScaleWidth      =   8160
  15.    Top             =   1605
  16.    Width           =   8280
  17.    Begin ListBox List1 
  18.       Height          =   1005
  19.       Left            =   240
  20.       TabIndex        =   1
  21.       Top             =   3870
  22.       Visible         =   0   'False
  23.       Width           =   1635
  24.    End
  25.    Begin Data Data1 
  26.       Caption         =   "Data1"
  27.       Connect         =   ";"
  28.       DatabaseName    =   "NATIONS.MDB"
  29.       Exclusive       =   0   'False
  30.       Height          =   270
  31.       Left            =   1920
  32.       Options         =   0
  33.       ReadOnly        =   0   'False
  34.       RecordSource    =   "Sales"
  35.       Top             =   3900
  36.       Visible         =   0   'False
  37.       Width           =   1155
  38.    End
  39.    Begin TrueGrid Table1 
  40.       AllowArrows     =   -1  'True
  41.       AllowTabs       =   -1  'True
  42.       BackColor       =   &H00C0C0C0&
  43.       DataSource      =   "Data1"
  44.       Editable        =   -1  'True
  45.       EditDropDown    =   -1  'True
  46.       ExposeCellMode  =   0  'Expose upon selection
  47.       FetchMode       =   0  'By cell
  48.       FontBold        =   0   'False
  49.       FontItalic      =   0   'False
  50.       FontName        =   "MS Sans Serif"
  51.       FontSize        =   8.25
  52.       FontStrikethru  =   0   'False
  53.       FontUnderline   =   0   'False
  54.       HeadingHeight   =   1
  55.       Height          =   3525
  56.       HorzLines       =   2  '3D
  57.       Layout          =   COUNTRY.FRX:0302
  58.       Left            =   210
  59.       LinesPerRow     =   2
  60.       MarqueeUnique   =   -1  'True
  61.       SplitPropsGlobal=   -1  'True
  62.       SplitTabMode    =   0  'Don't tab across splits
  63.       TabCapture      =   0   'False
  64.       TabIndex        =   0
  65.       Top             =   180
  66.       UseBookmarks    =   -1  'True
  67.       Width           =   7725
  68.       WrapCellPointer =   0   'False
  69.    End
  70.    Begin Menu ExitMenuOption 
  71.       Caption         =   "E&xit!"
  72.    End
  73.    Begin Menu HelpMenuOption 
  74.       Caption         =   "&Help"
  75.       Begin Menu HelpOption 
  76.          Caption         =   "&Index"
  77.          Index           =   1
  78.       End
  79.       Begin Menu HelpOption 
  80.          Caption         =   "&Using Help"
  81.          Index           =   2
  82.       End
  83.       Begin Menu HelpOption 
  84.          Caption         =   "-"
  85.          Index           =   3
  86.       End
  87.       Begin Menu HelpOption 
  88.          Caption         =   "&About In-Cell Graphic Sample"
  89.          Index           =   4
  90.       End
  91.    End
  92. Option Explicit
  93. Dim Status As Integer
  94. Sub AddCountry (txt As String)
  95.     ' Add country to list box
  96.     List1.AddItem txt
  97. End Sub
  98. Sub CenterForm (F As Form)
  99.     ' Center the specified form within the screen
  100.     F.Move (Screen.Width - F.Width) \ 2, (Screen.Height - F.Height) \ 2
  101. End Sub
  102. Sub Exit_Click ()
  103.     ' Unload forms
  104.     Unload CountryFrm
  105.     Unload About
  106.     End
  107. End Sub
  108. Sub ExitMenuOption_Click ()
  109.     'Unload forms and exit
  110.     Unload About
  111.     Unload CountryFrm
  112.     End
  113. End Sub
  114. Sub Form_Load ()
  115.     Dim dbdir As String
  116.     ' Center form on screen
  117.     CenterForm CountryFrm
  118.     ' Open database in current directory
  119.     dbdir = App.Path
  120.     Data1.DatabaseName = dbdir + "\nations.mdb"
  121.     ' Display column button for flags column
  122.     Table1.ColumnButton(1) = True
  123.     ' Populate combo box
  124.     AddCountry "Australia"
  125.     AddCountry "Austria"
  126.     AddCountry "Brazil"
  127.     AddCountry "Canada"
  128.     AddCountry "Denmark"
  129.     AddCountry "Finland"
  130.     AddCountry "France"
  131.     AddCountry "Germany"
  132.     AddCountry "Ireland"
  133.     AddCountry "Italy"
  134.     AddCountry "Japan"
  135.     AddCountry "Mexico"
  136.     AddCountry "Netherlands"
  137.     AddCountry "Norway"
  138.     AddCountry "New Zealand"
  139.     AddCountry "Portugal"
  140.     AddCountry "Spain"
  141.     AddCountry "Sweden"
  142.     AddCountry "Switzerland"
  143.     AddCountry "Turkey"
  144.     AddCountry "United Kingdom"
  145.     AddCountry "United States"
  146. End Sub
  147. Sub HelpOption_Click (index As Integer)
  148.     'This event calls the WinHelp EXE and a location to goto based on which selection the user has chosen
  149.     'Case 4 shows the about box for True Browser
  150.     Select Case index
  151.     Case 1
  152.     HelpContext CountryFrm, HELP_GRAPHIC
  153.     Case 2
  154.     HelpOnHelp CountryFrm
  155.     Case 4
  156.     About.Show 1
  157.     End Select
  158. End Sub
  159. Sub List1_DblClick ()
  160.     ' If the user double clicks a selection enter it in the database
  161.     ' and make the list box invisible
  162.     Table1.ColumnText(TgFindColumn(Table1, "Country")) = List1.List(List1.ListIndex)
  163.     List1.Visible = False
  164. End Sub
  165. Sub List1_LostFocus ()
  166.     ' If the user clicks elsewhere on the form
  167.     ' then hide the list box
  168.     List1.Visible = False
  169.     ' Toggle Status variable
  170.     Status = Status Xor True
  171. End Sub
  172. Sub Table1_Append ()
  173.     ' Add a new record
  174.     Data1.Recordset.AddNew
  175. End Sub
  176. Sub Table1_ClickButton ()
  177.     ' If the user clicks on the flag column button then bring up list box
  178.     If Table1.ColumnName(Table1.ColumnIndex) = "Country" Then
  179.     Status = Status Xor True    ' Toggle between true and false
  180.     If Status Then
  181.         List1.Left = Table1.CellRectLeft
  182.         List1.Top = Table1.CellRectTop + Table1.CellRectHeight
  183.         List1.Visible = True
  184.         List1.SetFocus
  185.     Else
  186.         List1.Visible = False
  187.         Status = Status Xor True
  188.     End If
  189.     End If
  190. End Sub
  191. Sub Table1_KeyDown (KeyCode As Integer, Shift As Integer)
  192.     ' The user wants to delete a row when not in edit mode
  193.     If KeyCode = KEY_DELETE And Not Table1.EditActive Then Data1.Recordset.Delete
  194. End Sub
  195.