home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmForm
- BorderStyle = 3 'Fixed Double
- Caption = "File Form"
- ClipControls = 0 'False
- ControlBox = 0 'False
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 3585
- Icon = 0
- Left = 1185
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3240
- ScaleWidth = 6915
- Top = 1530
- Width = 6975
- Begin CommandButton cmdOk
- Caption = "OK"
- Default = -1 'True
- Height = 375
- Left = 5520
- TabIndex = 8
- Top = 165
- Width = 1230
- End
- Begin TextBox txtFileName
- Height = 285
- Left = 160
- TabIndex = 1
- Text = "*.sav"
- Top = 405
- Width = 2385
- End
- Begin CommandButton cmdCancel
- Cancel = -1 'True
- Caption = "Cancel"
- Height = 375
- Left = 5535
- TabIndex = 9
- Top = 690
- Width = 1215
- End
- Begin FileListBox filFiles
- Height = 1590
- Left = 160
- Pattern = "*.txt"
- TabIndex = 2
- Top = 765
- Width = 2385
- End
- Begin DirListBox dirDirs
- Height = 1605
- Left = 2860
- TabIndex = 5
- Top = 735
- Width = 2385
- End
- Begin ComboBox Combo1
- Height = 300
- Left = 160
- Style = 2 'Dropdown List
- TabIndex = 12
- Top = 2760
- Width = 2385
- End
- Begin DriveListBox drvDrives
- Height = 1470
- Left = 2865
- TabIndex = 7
- Top = 2745
- Width = 2385
- End
- Begin Label Label1
- AutoSize = -1 'True
- Caption = "List Files of &Type:"
- Height = 195
- Left = 160
- TabIndex = 11
- Top = 2535
- Width = 2385
- End
- Begin Label lblFileName
- AutoSize = -1 'True
- Caption = "File &Name:"
- Height = 195
- Left = 160
- TabIndex = 0
- Top = 165
- Width = 2385
- End
- Begin Label lblDirectories
- AutoSize = -1 'True
- Caption = "&Directories:"
- Height = 195
- Left = 2860
- TabIndex = 3
- Top = 180
- Width = 2385
- End
- Begin Label lblCurrentDir
- Height = 225
- Left = 2860
- TabIndex = 4
- Top = 450
- Width = 2385
- End
- Begin Label lblDrives
- AutoSize = -1 'True
- Caption = "Dri&ves:"
- Height = 195
- Left = 2860
- TabIndex = 6
- Top = 2520
- Width = 2385
- End
- Sub cmdCancel_Click ()
- ' Set the file name text box to null.
- ' By checking the text property of this text box,
- ' other procedures can tell if Cancel has been
- ' selected.
- frmForm.txtFileName.Text = ""
- ' Hide the form
- Unload frmForm
- End Sub
- Sub cmdOK_Click ()
- FileName = txtFileName.Text
- Select Case frmForm.Caption
- Case "Open"
- OpenFile FileName
- Case "Save As"
- SaveFileAs FileName
- End Select
- End Sub
- Sub Combo1_Click ()
- Select Case combo1.ListIndex
- ' Text Files (*.txt)
- Case 0
- NewPattern = "*.sav"
- ' All Files (*.*)
- Case 1
- NewPattern = "*.*"
- End Select
- txtFileName.Text = NewPattern
- filFiles.Pattern = NewPattern
- ' reinitialize the file controls
- filFiles.Refresh
- End Sub
- Sub dirDirs_Change ()
- ' propogate directory changes to other controls
- filFiles.Path = dirDirs.Path
- 'if path is too long, display only last directory
- If Len(dirDirs.Path) > 25 Then
- tmp$ = dirDirs.Path
- i = 0
- pos = 1
- Do While pos <> 0
- i = pos + 1
- pos = InStr(i, tmp$, "\")
- Loop
- First$ = Mid$(tmp$, 1, InStr(tmp$, "\"))
- Middle$ = "... "
- Last$ = Mid$(tmp$, i - 1)
- Final$ = First$ + Middle$ + Last$
- lblCurrentDir.Caption = Final$
- Else
- lblCurrentDir.Caption = dirDirs.Path
- End If
- ChDir dirDirs.Path
- End Sub
- Sub drvDrives_Change ()
- On Error Resume Next
- ' change the dirDirs control path, it will
- ' pass the change on to the filFiles control
- dirDirs.Path = drvDrives.Drive
- If Err Then
- MsgBox Error$
- drvDrives.Drive = dirDirs.Path
- Else
- ChDrive (drvDrives.Drive)
- End If
- End Sub
- Sub filFiles_Click ()
- ' echo the selected name in the Text box
- txtFileName.Text = filFiles.FileName
- End Sub
- Sub filFiles_DblClick ()
- ' we have a final selection from the File Save dialog
- txtFileName.Text = filFiles.FileName
- cmdOK_Click
- End Sub
- Sub filFiles_PathChange ()
- 'Show the current search pattern in the txtFileName control
- txtFileName.Text = filFiles.Pattern
- End Sub
- Sub filFiles_PatternChange ()
- txtFileName.Text = filFiles.Pattern
- End Sub
- Sub Form_Activate ()
- ' If File Open dialog, set Text box to current pattern
- If frmForm.Caption = "Open" Then
- txtFileName.Text = filFiles.Pattern
- End If
- ' If a File Save dialog, set the text box
- ' to the current file name
- If frmForm.Caption = "Save As" Then
- ' File is not named
- If frmMDI.Caption = "Savings - Untitled" Then
- frmForm.txtFileName.Text = filFiles.Pattern
- ' File has a name
- Else
- frmForm.txtFileName.Text = Mid$(frmMDI.Caption, 11)
- End If
- End If
- ' initialize file controls
- filFiles.Refresh
- ' set List_Files_of_Type list box to first item (*.sav)
- combo1.ListIndex = 0
- ' highlight the current selection
- frmForm.txtFileName.SelStart = 0
- frmForm.txtFileName.SelLength = Len(frmForm.txtFileName.Text)
- End Sub
- Sub Form_Load ()
- ' initialize path to savings project directory
- dirDirs.Path = App.Path
- ' display full path name in a label
- lblCurrentDir.Caption = dirDirs.Path
- ' add items to List Files of Type list
- combo1.AddItem "Text Files (*.sav)"
- combo1.AddItem "All Files (*.*)"
- End Sub
- Sub Form_Unload (Cancel As Integer)
- 'Cancel = True ' Don't unload form, just hide it
- 'frmForm.Hide
- End Sub
-