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

  1. VERSION 2.00
  2. Begin Form frmForm 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "File Form"
  5.    ClipControls    =   0   'False
  6.    ControlBox      =   0   'False
  7.    FontBold        =   -1  'True
  8.    FontItalic      =   0   'False
  9.    FontName        =   "System"
  10.    FontSize        =   9.75
  11.    FontStrikethru  =   0   'False
  12.    FontUnderline   =   0   'False
  13.    Height          =   3585
  14.    Icon            =   0
  15.    Left            =   1185
  16.    LinkMode        =   1  'Source
  17.    LinkTopic       =   "Form1"
  18.    MaxButton       =   0   'False
  19.    MinButton       =   0   'False
  20.    ScaleHeight     =   3240
  21.    ScaleWidth      =   6915
  22.    Top             =   1530
  23.    Width           =   6975
  24.    Begin CommandButton cmdOk 
  25.       Caption         =   "OK"
  26.       Default         =   -1  'True
  27.       Height          =   375
  28.       Left            =   5520
  29.       TabIndex        =   8
  30.       Top             =   165
  31.       Width           =   1230
  32.    End
  33.    Begin TextBox txtFileName 
  34.       Height          =   285
  35.       Left            =   160
  36.       TabIndex        =   1
  37.       Text            =   "*.sav"
  38.       Top             =   405
  39.       Width           =   2385
  40.    End
  41.    Begin CommandButton cmdCancel 
  42.       Cancel          =   -1  'True
  43.       Caption         =   "Cancel"
  44.       Height          =   375
  45.       Left            =   5535
  46.       TabIndex        =   9
  47.       Top             =   690
  48.       Width           =   1215
  49.    End
  50.    Begin FileListBox filFiles 
  51.       Height          =   1590
  52.       Left            =   160
  53.       Pattern         =   "*.txt"
  54.       TabIndex        =   2
  55.       Top             =   765
  56.       Width           =   2385
  57.    End
  58.    Begin DirListBox dirDirs 
  59.       Height          =   1605
  60.       Left            =   2860
  61.       TabIndex        =   5
  62.       Top             =   735
  63.       Width           =   2385
  64.    End
  65.    Begin ComboBox Combo1 
  66.       Height          =   300
  67.       Left            =   160
  68.       Style           =   2  'Dropdown List
  69.       TabIndex        =   12
  70.       Top             =   2760
  71.       Width           =   2385
  72.    End
  73.    Begin DriveListBox drvDrives 
  74.       Height          =   1470
  75.       Left            =   2865
  76.       TabIndex        =   7
  77.       Top             =   2745
  78.       Width           =   2385
  79.    End
  80.    Begin Label Label1 
  81.       AutoSize        =   -1  'True
  82.       Caption         =   "List Files of &Type:"
  83.       Height          =   195
  84.       Left            =   160
  85.       TabIndex        =   11
  86.       Top             =   2535
  87.       Width           =   2385
  88.    End
  89.    Begin Label lblFileName 
  90.       AutoSize        =   -1  'True
  91.       Caption         =   "File &Name:"
  92.       Height          =   195
  93.       Left            =   160
  94.       TabIndex        =   0
  95.       Top             =   165
  96.       Width           =   2385
  97.    End
  98.    Begin Label lblDirectories 
  99.       AutoSize        =   -1  'True
  100.       Caption         =   "&Directories:"
  101.       Height          =   195
  102.       Left            =   2860
  103.       TabIndex        =   3
  104.       Top             =   180
  105.       Width           =   2385
  106.    End
  107.    Begin Label lblCurrentDir 
  108.       Height          =   225
  109.       Left            =   2860
  110.       TabIndex        =   4
  111.       Top             =   450
  112.       Width           =   2385
  113.    End
  114.    Begin Label lblDrives 
  115.       AutoSize        =   -1  'True
  116.       Caption         =   "Dri&ves:"
  117.       Height          =   195
  118.       Left            =   2860
  119.       TabIndex        =   6
  120.       Top             =   2520
  121.       Width           =   2385
  122.    End
  123. Sub cmdCancel_Click ()
  124.     ' Set the file name text box to null.
  125.     ' By checking the text property of this text box,
  126.     ' other procedures can tell if Cancel has been
  127.     ' selected.
  128.     frmForm.txtFileName.Text = ""
  129.     ' Hide the form
  130.     Unload frmForm
  131. End Sub
  132. Sub cmdOK_Click ()
  133.     FileName = txtFileName.Text
  134.     Select Case frmForm.Caption
  135.     Case "Open"
  136.         OpenFile FileName
  137.     Case "Save As"
  138.         SaveFileAs FileName
  139.     End Select
  140. End Sub
  141. Sub Combo1_Click ()
  142.     Select Case combo1.ListIndex
  143.     ' Text Files (*.txt)
  144.     Case 0
  145.         NewPattern = "*.sav"
  146.     ' All Files (*.*)
  147.     Case 1
  148.         NewPattern = "*.*"
  149.     End Select
  150.     txtFileName.Text = NewPattern
  151.     filFiles.Pattern = NewPattern
  152.     ' reinitialize the file controls
  153.     filFiles.Refresh
  154. End Sub
  155. Sub dirDirs_Change ()
  156.     ' propogate directory changes to other controls
  157.     filFiles.Path = dirDirs.Path
  158.     'if path is too long, display only last directory
  159.     If Len(dirDirs.Path) > 25 Then
  160.         tmp$ = dirDirs.Path
  161.         i = 0
  162.         pos = 1
  163.         Do While pos <> 0
  164.             i = pos + 1
  165.             pos = InStr(i, tmp$, "\")
  166.         Loop
  167.         First$ = Mid$(tmp$, 1, InStr(tmp$, "\"))
  168.         Middle$ = "... "
  169.         Last$ = Mid$(tmp$, i - 1)
  170.         Final$ = First$ + Middle$ + Last$
  171.         lblCurrentDir.Caption = Final$
  172.     Else
  173.          lblCurrentDir.Caption = dirDirs.Path
  174.     End If
  175.     ChDir dirDirs.Path
  176. End Sub
  177. Sub drvDrives_Change ()
  178. On Error Resume Next
  179.     ' change the dirDirs control path, it will
  180.     ' pass the change on to the filFiles control
  181.     dirDirs.Path = drvDrives.Drive
  182.     If Err Then
  183.         MsgBox Error$
  184.         drvDrives.Drive = dirDirs.Path
  185.     Else
  186.         ChDrive (drvDrives.Drive)
  187.     End If
  188. End Sub
  189. Sub filFiles_Click ()
  190.     ' echo the selected name in the Text box
  191.     txtFileName.Text = filFiles.FileName
  192. End Sub
  193. Sub filFiles_DblClick ()
  194.     ' we have a final selection from the File Save dialog
  195.     txtFileName.Text = filFiles.FileName
  196.     cmdOK_Click
  197. End Sub
  198. Sub filFiles_PathChange ()
  199.     'Show the current search pattern in the txtFileName control
  200.     txtFileName.Text = filFiles.Pattern
  201. End Sub
  202. Sub filFiles_PatternChange ()
  203.     txtFileName.Text = filFiles.Pattern
  204. End Sub
  205. Sub Form_Activate ()
  206.     ' If File Open dialog, set Text box to current pattern
  207.     If frmForm.Caption = "Open" Then
  208.         txtFileName.Text = filFiles.Pattern
  209.     End If
  210.     ' If a File Save dialog, set the text box
  211.     ' to the current file name
  212.     If frmForm.Caption = "Save As" Then
  213.         ' File is not named
  214.         If frmMDI.Caption = "Savings - Untitled" Then
  215.             frmForm.txtFileName.Text = filFiles.Pattern
  216.         ' File has a name
  217.         Else
  218.             frmForm.txtFileName.Text = Mid$(frmMDI.Caption, 11)
  219.         End If
  220.     End If
  221.     ' initialize file controls
  222.     filFiles.Refresh
  223.     ' set List_Files_of_Type list box to first item (*.sav)
  224.     combo1.ListIndex = 0
  225.     ' highlight the current selection
  226.     frmForm.txtFileName.SelStart = 0
  227.     frmForm.txtFileName.SelLength = Len(frmForm.txtFileName.Text)
  228. End Sub
  229. Sub Form_Load ()
  230.     ' initialize path to savings project directory
  231.     dirDirs.Path = App.Path
  232.     ' display full path name in a label
  233.     lblCurrentDir.Caption = dirDirs.Path
  234.     ' add items to List Files of Type list
  235.     combo1.AddItem "Text Files (*.sav)"
  236.     combo1.AddItem "All Files (*.*)"
  237. End Sub
  238. Sub Form_Unload (Cancel As Integer)
  239.     'Cancel = True   ' Don't unload form, just hide it
  240.     'frmForm.Hide
  241. End Sub
  242.