home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l406 / 1.ddi / FILEOPE2.FR_ / FILEOPE2.bin (.txt)
Encoding:
Visual Basic Form  |  1992-10-21  |  6.9 KB  |  225 lines

  1. VERSION 2.00
  2. Begin Form FileForm 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "File Form"
  5.    ControlBox      =   0   'False
  6.    FontBold        =   -1  'True
  7.    FontItalic      =   0   'False
  8.    FontName        =   "System"
  9.    FontSize        =   9.75
  10.    FontStrikethru  =   0   'False
  11.    FontUnderline   =   0   'False
  12.    Height          =   3510
  13.    Icon            =   FILEOPEN.FRX:0000
  14.    Left            =   1485
  15.    LinkMode        =   1  'Source
  16.    LinkTopic       =   "Form1"
  17.    MaxButton       =   0   'False
  18.    MinButton       =   0   'False
  19.    ScaleHeight     =   3105
  20.    ScaleWidth      =   5640
  21.    Top             =   1605
  22.    Width           =   5760
  23.    Begin CommandButton cmdOk 
  24.       Caption         =   "OK"
  25.       Default         =   -1  'True
  26.       Height          =   420
  27.       Left            =   4320
  28.       TabIndex        =   8
  29.       Top             =   120
  30.       Width           =   1125
  31.    End
  32.    Begin TextBox txtFileName 
  33.       Height          =   375
  34.       Left            =   240
  35.       TabIndex        =   1
  36.       Text            =   "*.txt"
  37.       Top             =   360
  38.       Width           =   1575
  39.    End
  40.    Begin CommandButton cmdCancel 
  41.       Cancel          =   -1  'True
  42.       Caption         =   "Cancel"
  43.       Height          =   420
  44.       Left            =   4320
  45.       TabIndex        =   9
  46.       Top             =   720
  47.       Width           =   1125
  48.    End
  49.    Begin FileListBox filFiles 
  50.       Height          =   1395
  51.       Left            =   240
  52.       Pattern         =   "*.txt"
  53.       TabIndex        =   2
  54.       Top             =   840
  55.       Width           =   1620
  56.    End
  57.    Begin DirListBox dirDirs 
  58.       Height          =   1425
  59.       Left            =   2040
  60.       TabIndex        =   5
  61.       Top             =   840
  62.       Width           =   2100
  63.    End
  64.    Begin ComboBox cboFiletype 
  65.       Height          =   300
  66.       Left            =   240
  67.       Style           =   2  'Dropdown List
  68.       TabIndex        =   12
  69.       Top             =   2640
  70.       Width           =   1695
  71.    End
  72.    Begin DriveListBox drvDrives 
  73.       Height          =   1530
  74.       Left            =   2040
  75.       TabIndex        =   7
  76.       Top             =   2640
  77.       Width           =   2115
  78.    End
  79.    Begin Label Label1 
  80.       Caption         =   "List Files of &Type:"
  81.       Height          =   255
  82.       Left            =   240
  83.       TabIndex        =   11
  84.       Top             =   2400
  85.       Width           =   1695
  86.    End
  87.    Begin Label lblFileName 
  88.       Caption         =   "File &Name:"
  89.       Height          =   240
  90.       Left            =   240
  91.       TabIndex        =   0
  92.       Top             =   120
  93.       Width           =   1200
  94.    End
  95.    Begin Label lblDirectories 
  96.       Caption         =   "&Directories:"
  97.       Height          =   240
  98.       Left            =   2040
  99.       TabIndex        =   3
  100.       Top             =   150
  101.       Width           =   1200
  102.    End
  103.    Begin Label lblCurrentDir 
  104.       Height          =   225
  105.       Left            =   2040
  106.       TabIndex        =   4
  107.       Top             =   480
  108.       Width           =   2085
  109.    End
  110.    Begin Label lblDrives 
  111.       Caption         =   "Dri&ves:"
  112.       Height          =   255
  113.       Left            =   2040
  114.       TabIndex        =   6
  115.       Top             =   2400
  116.       Width           =   765
  117.    End
  118. Sub cboFiletype_Click ()
  119.     Select Case cboFiletype.ListIndex
  120.         Case 0      ' Text Files (*.txt)
  121.             NewPattern = "*.txt"
  122.         Case 1      ' All Files (*.*)
  123.             NewPattern = "*.*"
  124.     End Select
  125.     txtFileName.Text = NewPattern
  126.     filFiles.Pattern = NewPattern
  127.     ' reinitialize the file controls
  128.     filFiles.Refresh
  129. End Sub
  130. Sub cmdcancel_Click ()
  131.     ' Set the file name text box to null.
  132.     ' By checking the text property of this text box,
  133.     ' other procedures can tell if Cancel has been
  134.     ' selected.
  135.     FileForm.txtFileName.Text = Empty
  136.     ' Hide the form
  137.     FileForm.Hide
  138. End Sub
  139. Sub cmdOK_Click ()
  140. Dim Msg As String
  141. On Error Resume Next
  142.     If txtFileName.Text Like "*[;>]*" Or txtFileName.Text Like "*[ ,+|/]*" Then
  143.         Msg = "Bad filename"
  144.         ' Display error and select the offending text.
  145.         MsgBox Msg, 48, App.EXEName
  146.         txtFileName.SetFocus
  147.         txtFileName.SelStart = 0
  148.         txtFileName.SelLength = Len(txtFileName.Text)
  149.     Else
  150.         Hide
  151.     End If
  152. End Sub
  153. Sub dirDirs_Change ()
  154.     ' propogate directory changes to other controls
  155.     filFiles.Path = dirDirs.Path
  156.     lblCurrentDir.Caption = dirDirs.Path
  157.     ChDir dirDirs.Path
  158.     txtFileName.Text = filFiles.Pattern
  159. End Sub
  160. Sub drvDrives_Change ()
  161.     ' change the dirDirs control path, it will
  162.     ' pass the change on to the filFiles control
  163.     dirDirs.Path = drvDrives.Drive
  164.     ChDrive (drvDrives.Drive)
  165. End Sub
  166. Sub filFiles_Click ()
  167.     ' echo the selected name in the Text box
  168.     txtFileName.Text = filFiles.FileName
  169. End Sub
  170. Sub filFiles_DblClick ()
  171.     ' we have a final selection from the File Save dialog
  172.     'txtFilename.Text = filFiles.FileName
  173.     cmdOK_Click
  174. End Sub
  175. Sub filFiles_PathChange ()
  176.     dirDirs.Path = filFiles.Path
  177.     drvDrives.Drive = filFiles.Path
  178. End Sub
  179. Sub filFiles_PatternChange ()
  180.     'Show the current search pattern in the txtFileName control
  181.     txtFileName.Text = filFiles.Pattern
  182.     dirDirs.Path = filFiles.Path
  183. End Sub
  184. Sub Form_Activate ()
  185.     ' If File Open dialog, set Text box to current pattern
  186.     If FileForm.Caption = "Open" Then
  187.         txtFileName.Text = filFiles.Pattern
  188.     End If
  189.     ' If a File Save dialog, set the text box
  190.     ' to the current file name
  191.     If FileForm.Caption = "Save As" Then
  192.         ' File is not named
  193.         If frmMDI.ActiveForm.Caption = "Untitled" Then
  194.             FileForm.txtFileName.Text = filFiles.Pattern
  195.         ' File has a name
  196.         Else
  197.             FileForm.txtFileName.Text = frmMDI.ActiveForm.Caption
  198.     End If
  199.     End If
  200.     ' initialize file controls
  201.     filFiles.Refresh
  202.     ' Clear current selection in Filetype list box
  203.     cboFiletype.ListIndex = -1
  204.     ' Set FileType list box to first item (*.txt)
  205.     cboFiletype.ListIndex = 0
  206.     ' highlight the current selection
  207.     FileForm.txtFileName.SelStart = 0
  208.     FileForm.txtFileName.SelLength = Len(FileForm.txtFileName.Text)
  209. End Sub
  210. Sub Form_Load ()
  211.     ' display full path name in a label
  212.     lblCurrentDir.Caption = dirDirs.Path
  213.     ' add items to List Files of Type list
  214.     cboFiletype.AddItem "Text Files (*.txt)"
  215.     cboFiletype.AddItem "All Files (*.*)"
  216. End Sub
  217. Sub Form_Unload (Cancel As Integer)
  218.     Cancel = True   ' Don't unload form, just hide it
  219.     Call cmdcancel_Click
  220. End Sub
  221. Sub txtFileName_Change ()
  222.     ' Disable OK button if no filename.
  223.     cmdOK.Enabled = (Len(txtFileName.Text) > 0)
  224. End Sub
  225.