home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Basic / Samples / VB_SMPL / VB_SMPL.ZIP / CDPLAY.EXE / CDPLAYE2.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-03-30  |  10.7 KB  |  332 lines

  1. VERSION 2.00
  2. Begin Form CDEntry 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Compact Disc Database"
  6.    ClientHeight    =   6510
  7.    ClientLeft      =   2940
  8.    ClientTop       =   2475
  9.    ClientWidth     =   6135
  10.    ClipControls    =   0   'False
  11.    Height          =   6915
  12.    Left            =   2880
  13.    LinkTopic       =   "Form2"
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   6510
  16.    ScaleWidth      =   6135
  17.    Top             =   2130
  18.    Width           =   6255
  19.    Begin SSPanel Panel3D1 
  20.       BackColor       =   &H00C0C0C0&
  21.       BevelInner      =   1  'Inset
  22.       BevelOuter      =   1  'Inset
  23.       Font3D          =   0  'None
  24.       Height          =   6255
  25.       Left            =   120
  26.       TabIndex        =   10
  27.       Top             =   120
  28.       Width           =   5895
  29.       Begin PictureBox PicLogo 
  30.          AutoSize        =   -1  'True
  31.          BackColor       =   &H00C0C0C0&
  32.          BorderStyle     =   0  'None
  33.          Height          =   615
  34.          Left            =   1680
  35.          ScaleHeight     =   615
  36.          ScaleWidth      =   2535
  37.          TabIndex        =   11
  38.          Top             =   120
  39.          Width           =   2535
  40.          Begin Label lblLogo 
  41.             AutoSize        =   -1  'True
  42.             BackStyle       =   0  'Transparent
  43.             Caption         =   "CD Player"
  44.             FontBold        =   -1  'True
  45.             FontItalic      =   -1  'True
  46.             FontName        =   "MS Serif"
  47.             FontSize        =   24
  48.             FontStrikethru  =   0   'False
  49.             FontUnderline   =   0   'False
  50.             ForeColor       =   &H00C00000&
  51.             Height          =   525
  52.             Index           =   0
  53.             Left            =   0
  54.             TabIndex        =   12
  55.             Top             =   0
  56.             Width           =   2415
  57.          End
  58.          Begin Label lblLogo 
  59.             AutoSize        =   -1  'True
  60.             BackStyle       =   0  'Transparent
  61.             Caption         =   "CD Player"
  62.             FontBold        =   -1  'True
  63.             FontItalic      =   -1  'True
  64.             FontName        =   "MS Serif"
  65.             FontSize        =   24
  66.             FontStrikethru  =   0   'False
  67.             FontUnderline   =   0   'False
  68.             ForeColor       =   &H00FFFFFF&
  69.             Height          =   525
  70.             Index           =   1
  71.             Left            =   0
  72.             TabIndex        =   13
  73.             Top             =   30
  74.             Width           =   2415
  75.          End
  76.       End
  77.       Begin CommandButton Command1 
  78.          Cancel          =   -1  'True
  79.          Caption         =   "&Cancel"
  80.          Height          =   495
  81.          Index           =   2
  82.          Left            =   240
  83.          TabIndex        =   9
  84.          Top             =   5520
  85.          Width           =   5415
  86.       End
  87.       Begin CommandButton Command1 
  88.          Caption         =   "&Reset Tracks"
  89.          Height          =   495
  90.          Index           =   1
  91.          Left            =   240
  92.          TabIndex        =   8
  93.          Top             =   4920
  94.          Width           =   5415
  95.       End
  96.       Begin TextBox Text3 
  97.          Alignment       =   2  'Center
  98.          Height          =   375
  99.          Left            =   240
  100.          MultiLine       =   -1  'True
  101.          TabIndex        =   3
  102.          Top             =   1440
  103.          Width           =   5415
  104.       End
  105.       Begin CommandButton Command1 
  106.          Caption         =   "&Save"
  107.          Height          =   495
  108.          Index           =   0
  109.          Left            =   240
  110.          TabIndex        =   7
  111.          Top             =   4320
  112.          Width           =   5415
  113.       End
  114.       Begin TextBox Text2 
  115.          Alignment       =   2  'Center
  116.          Height          =   375
  117.          Left            =   240
  118.          MultiLine       =   -1  'True
  119.          TabIndex        =   1
  120.          Top             =   840
  121.          Width           =   5415
  122.       End
  123.       Begin TextBox Text1 
  124.          Alignment       =   2  'Center
  125.          Height          =   375
  126.          Left            =   240
  127.          MultiLine       =   -1  'True
  128.          TabIndex        =   5
  129.          TabStop         =   0   'False
  130.          Top             =   2160
  131.          Width           =   5415
  132.       End
  133.       Begin ListBox List1 
  134.          Height          =   1395
  135.          Left            =   240
  136.          TabIndex        =   6
  137.          Top             =   2640
  138.          Width           =   5415
  139.       End
  140.       Begin Label Label3 
  141.          AutoSize        =   -1  'True
  142.          BackStyle       =   0  'Transparent
  143.          Caption         =   "&Artist:"
  144.          Height          =   195
  145.          Left            =   240
  146.          TabIndex        =   2
  147.          Top             =   1200
  148.          Width           =   510
  149.       End
  150.       Begin Label Label2 
  151.          AutoSize        =   -1  'True
  152.          BackStyle       =   0  'Transparent
  153.          Caption         =   "C&D Title:"
  154.          Height          =   195
  155.          Left            =   240
  156.          TabIndex        =   0
  157.          Top             =   600
  158.          Width           =   765
  159.       End
  160.       Begin Label Label1 
  161.          AutoSize        =   -1  'True
  162.          BackStyle       =   0  'Transparent
  163.          Caption         =   "&Track Title:"
  164.          Height          =   195
  165.          Left            =   240
  166.          TabIndex        =   4
  167.          Top             =   1920
  168.          Width           =   5415
  169.       End
  170.    End
  171. Option Explicit
  172. Dim SelIndex As Integer
  173. Dim Text1Dirty As Integer
  174. Dim List1Dirty As Integer
  175. Sub Command1_Click (Index As Integer)
  176.     Dim Answer As Integer
  177.     Static Dirty As Integer
  178.     Select Case Index
  179.         Case 0 ' Save
  180.             If Text1Dirty = True Then
  181.                 Answer = MsgBox("Edit In Progress, Abort?", 4, "OOPS!")
  182.                 If Answer = 6 Then
  183.                 Answer = MsgBox("Save Changes?", 4, "Save")
  184.                     If Answer = 6 Then
  185.                         Call UpdateTracks(List1, True)
  186.                         CommitChanges
  187.                         CDInfo.CDTitle = Text2
  188.                         CDInfo.CDAuthor = Text3
  189.                         Unload Me
  190.                     ElseIf Answer = 7 Then
  191.                         Unload Me
  192.                     End If
  193.                 ElseIf Answer = 7 Then
  194.                     Text1.SetFocus
  195.                     Exit Sub
  196.                 End If
  197.             Else
  198.                 Answer = MsgBox("Save Changes?", 4, "Save")
  199.                 If Answer = 6 Then
  200.                     Call UpdateTracks(List1, True)
  201.                     CDInfo.CDTitle = Text2
  202.                     CDInfo.CDAuthor = Text3
  203.                     CommitChanges
  204.                     Unload Me
  205.                 ElseIf Answer = 7 Then
  206.                     Unload Me
  207.                 End If
  208.             End If
  209.         Case 1 ' Reset Titles
  210.             Call UpdateTracks(List1, False)
  211.             Call LoadListBox(List1)
  212.             Dirty = True
  213.         Case 2 ' Cancel
  214.             If Dirty = True Then GetCDInfo
  215.             Unload Me
  216.     End Select
  217. End Sub
  218. Sub Form_Activate ()
  219.     Text2.SetFocus
  220. End Sub
  221. Sub Form_Load ()
  222.     CenterForm CDEntry, False
  223.     CenterLogo Me, Panel3D1
  224.     Text2 = CDInfo.CDTitle
  225.     Text3 = CDInfo.CDAuthor
  226.     Call LoadListBox(List1)
  227.     If CDForm.mnuOptionsItem(2).Checked Then OnTop CDForm
  228. End Sub
  229. Sub Form_Unload (Cancel As Integer)
  230.     If CDForm.mnuOptionsItem(2).Checked Then OnTop CDForm
  231. End Sub
  232. Sub List1_Click ()
  233.     Dim Title As String
  234.     Title = Mid$(List1.Text, (InStr(List1.Text, Chr$(9)) + 1), (Len(List1.Text) - (InStr(List1.Text, Chr$(9)))))
  235.     Title = (Left$(Title, (InStr(Title, Chr$(9)) - 1)))
  236.     Text1 = Title
  237. End Sub
  238. Sub List1_DblClick ()
  239.     Dim Title As String
  240.     Title = Mid$(List1.Text, (InStr(List1.Text, Chr$(9)) + 1), (Len(List1.Text) - (InStr(List1.Text, Chr$(9)))))
  241.     Title = (Left$(Title, (InStr(Title, Chr$(9)) - 1)))
  242.     Text1 = Title
  243.     Text1.SetFocus
  244.     Text1.SelStart = 0
  245.     Text1.SelLength = Len(Text1)
  246.     SelIndex = List1.ListIndex
  247.     List1Dirty = True
  248. End Sub
  249. Sub List1_GotFocus ()
  250.     Dim Ans As Integer
  251.     If Text1Dirty = True Then
  252.         Ans = MsgBox("Abandon Edit?", 4, "Edit In Progress!")
  253.         If Ans = 6 Then
  254.             List1.Selected(SelIndex) = True
  255.             List1.SetFocus
  256.             Text1Dirty = False
  257.             List1Dirty = False
  258.             Exit Sub
  259.         ElseIf Ans = 7 Then
  260.             List1.Selected(SelIndex) = True
  261.             Text1.SetFocus
  262.             Text1.SelStart = 0
  263.             Text1.SelLength = (Len(Text1))
  264.             List1Dirty = True
  265.         End If
  266.     End If
  267. End Sub
  268. Sub List1_KeyPress (KeyAscii As Integer)
  269.     Dim Title As String
  270.     If KeyAscii = 13 Then
  271.         If List1.Text = "" Then Exit Sub
  272.         Title = Mid$(List1.Text, (InStr(List1.Text, Chr$(9)) + 1), (Len(List1.Text) - (InStr(List1.Text, Chr$(9)))))
  273.         Title = (Left$(Title, (InStr(Title, Chr$(9)) - 1)))
  274.         Text1 = Title
  275.         Text1.SetFocus
  276.         Text1.SelStart = 0
  277.         Text1.SelLength = Len(Text1)
  278.         SelIndex = List1.ListIndex
  279.         List1Dirty = True
  280.     End If
  281. End Sub
  282. Sub Text1_Change ()
  283.     Text1Dirty = True
  284. End Sub
  285. Sub Text1_GotFocus ()
  286.     If List1Dirty = False Then
  287.         MsgBox "You must Select and item from the List Box" & CRLF & "Hit Enter or Select With Mouse", 0, "Please Select An Item To Edit"
  288.         List1.SetFocus
  289.         List1.Selected(SelIndex) = True
  290.     Else
  291.         Text1.SelStart = 0
  292.         Text1.SelLength = (Len(Text1))
  293.     End If
  294. End Sub
  295. Sub Text1_KeyPress (KeyAscii As Integer)
  296.     If KeyAscii = 13 Then
  297.         List1.RemoveItem SelIndex
  298.         List1.AddItem (SelIndex + 1) & ":" & Chr$(9) & (Left$(Text1, 30)) & Chr$(9) & CDTime(SelIndex + 1), SelIndex
  299.         Text1 = ""
  300.         List1.SetFocus
  301.         If List1.ListCount > (SelIndex + 1) Then
  302.             List1.Selected(SelIndex + 1) = True
  303.         Else
  304.             List1.Selected(SelIndex) = True
  305.         End If
  306.         KeyAscii = 0
  307.         Text1Dirty = False
  308.         List1Dirty = False
  309.     End If
  310. End Sub
  311. Sub Text2_GotFocus ()
  312.     Text2.SelStart = 0
  313.     Text2.SelLength = Len(Text2)
  314. End Sub
  315. Sub Text2_KeyPress (KeyAscii As Integer)
  316.     If KeyAscii = 13 Then
  317.         Text3.SetFocus
  318.         KeyAscii = 0
  319.     End If
  320. End Sub
  321. Sub Text3_GotFocus ()
  322.     Text3.SelStart = 0
  323.     Text3.SelLength = Len(Text3)
  324. End Sub
  325. Sub Text3_KeyPress (KeyAscii As Integer)
  326.     If KeyAscii = 13 Then
  327.         List1.SetFocus
  328.         Text1Dirty = False
  329.         KeyAscii = 0
  330.     End If
  331. End Sub
  332.