home *** CD-ROM | disk | FTP | other *** search
- Type APISaveAsMasterForm From SampleMasterForm
- Dim SaveAsPanel As New SaveAsDialog
- Dim btnSaveAs As New Button
- Dim Label1 As New Label
- Dim Label2 As New Label
- Dim lblFilePath As New Label
- Dim Label3 As New Label
- Dim lblFileName As New Label
- Dim Label5 As New Label
- Dim lblDirectory As New Label
- Dim Label4 As New Label
- Dim txtTitle As New TextBox
- Dim Label7 As New Label
- Dim chkNoChangeDir As New CheckBox
- Dim chkNoNetworkButton As New CheckBox
- Dim chkPathMustExist As New CheckBox
-
- ' METHODS for object: APISaveAsMasterForm
- Sub chkNoChangeDir_Click()
- If chkNoChangeDir.Value == 0 Then
- SaveAsPanel.NoChangeDir = "False"
- Else
- SaveAsPanel.NoChangeDir = "True"
- End If
- End Sub
-
- Sub chkNoNetworkButton_Click()
- If chkNoNetworkButton.Value == 0 Then
- SaveAsPanel.NoNetworkButton = "False"
- Else
- SaveAsPanel.NoNetworkButton = "True"
- End If
- End Sub
-
- Sub chkPathMustExist_Click()
- If chkPathMustExist.Value == 0 Then
- SaveAsPanel.PathMustExist = "False"
- Else
- SaveAsPanel.PathMustExist = "True"
- End If
- End Sub
-
- Function EchoDirectory(filepath As String) As String
- Dim found As Integer
- Dim startpos As Integer
-
- If filepath == "" Then
- EchoDirectory = ""
- Else
- ' Locate the last "\" in the filepath string
- startpos = 0
- found = 1
- Do While found <> 0
- found = Instr(startpos, filepath, "\")
- If found <> 0 Then
- startpos = found + 1
- Else
- If startpos == 0 Then
- EchoDirectory = filepath
- Else
- startpos = startpos - 2
- EchoDirectory = Left(filepath, startpos)
- End If
- End If
- Loop
- End If
- End Function
-
- Function EchoFilename(filepath As String) As String
- Dim found As Integer
- Dim startpos As Integer
- Dim length As Integer
-
- If filepath == "" Then
- EchoFilename = ""
- Else
- ' Locate the last "\" in the filepath string
- startpos = 0
- found = 1
- length = Len(filepath)
- Do While found <> 0
- found = Instr(startpos, filepath, "\")
- If found <> 0 Then
- startpos = found + 1
- Else
- If startpos == 0 Then
- EchoFilename = filepath
- Else
- startpos = startpos
- EchoFilename = Mid(filepath, startpos, (length - startpos) + 1)
- End If
- End If
- Loop
- End If
- End Function
-
- Sub ResetApplication_Click ()
-
- ' Initialize SaveAs Dialog Demonstration
-
- ' Set SaveAs panel defaults
- SaveAsPanel.Filter = "All files (*.*)|*.*|"
-
- SaveAsPanel.NoChangeDir = "False"
- SaveAsPanel.NoNetworkButton = "False"
- SaveAsPanel.PathMustExist = "True"
-
- ' Set the checkbox defaults
- chkNoChangeDir.Value = 0
- chkNoNetworkButton.Value = 0
- chkPathMustExist.Value = 1
-
- ' Clear out the file/directory labels
- lblDirectory.Caption = ""
- lblFileName.Caption = ""
- lblFilePath.Caption = ""
-
- End Sub
-
- Sub btnSaveAs_Click()
-
- ' Insert the title in the SaveAs dialog
- SaveAsPanel.Title = txtTitle.Text
-
- ' Post the File SaveAs dialog box - should default to current directory
- SaveAsPanel.Execute
-
- ' If a filename was picked, then load the text file into the textedit box
- If SaveAsPanel.FileName <> "" Then
- lblFilePath.Caption = SaveAsPanel.FileName
- lblDirectory.Caption = EchoDirectory(SaveAsPanel.FileName)
- lblFileName.Caption = EchoFilename(SaveAsPanel.FileName)
- End If
- End Sub
-
- End Type
-
- Begin Code
- ' Reconstruction commands for object: APISaveAsMasterForm
- '
- With APISaveAsMasterForm
- .Caption := "Windows SaveAs Dialog Demonstration"
- .Move(7500, 855, 7800, 6075)
- .CurrentY := 64
- .SampleDir := "W:\Examples\apisavas\"
- .SampleName := "apisavas"
- With .SaveAsPanel
- .FileName := ""
- .Filter := "All files (*.*)|*.*|"
- .Title := "dialog title"
- End With 'APISaveAsMasterForm.SaveAsPanel
- With .btnSaveAs
- .Caption := "SaveAs"
- .Move(3450, 4650, 1800, 450)
- End With 'APISaveAsMasterForm.btnSaveAs
- With .Label1
- .Caption := "1. Click options below then the SaveAs button to select a file."
- .ForeColor := 13107200
- .Move(300, 300, 6300, 300)
- End With 'APISaveAsMasterForm.Label1
- With .Label2
- .Caption := "File Path:"
- .Move(300, 3150, 1050, 300)
- End With 'APISaveAsMasterForm.Label2
- With .lblFilePath
- .BackColor := 16777215
- .Move(1500, 3150, 5850, 300)
- .BorderStyle := "Fixed Single"
- End With 'APISaveAsMasterForm.lblFilePath
- With .Label3
- .Caption := "Filename:"
- .Move(300, 3600, 1050, 300)
- End With 'APISaveAsMasterForm.Label3
- With .lblFileName
- .BackColor := 16777215
- .Move(1500, 3600, 5850, 300)
- .BorderStyle := "Fixed Single"
- End With 'APISaveAsMasterForm.lblFileName
- With .Label5
- .Caption := "Directory:"
- .Move(300, 4050, 1050, 300)
- End With 'APISaveAsMasterForm.Label5
- With .lblDirectory
- .BackColor := 16777215
- .Move(1500, 4050, 5850, 300)
- .BorderStyle := "Fixed Single"
- End With 'APISaveAsMasterForm.lblDirectory
- With .Label4
- .Caption := "Dialog Title:"
- .Move(300, 900, 1200, 300)
- End With 'APISaveAsMasterForm.Label4
- With .txtTitle
- .Move(1500, 900, 5850, 360)
- End With 'APISaveAsMasterForm.txtTitle
- With .Label7
- .Caption := "SaveAs Dialog Options:"
- .Move(300, 1485, 2550, 300)
- End With 'APISaveAsMasterForm.Label7
- With .chkNoChangeDir
- .Caption := "No Change Directory"
- .Move(1500, 1890, 2700, 300)
- End With 'APISaveAsMasterForm.chkNoChangeDir
- With .chkNoNetworkButton
- .Caption := "No Network Button"
- .Move(1500, 2190, 2700, 300)
- End With 'APISaveAsMasterForm.chkNoNetworkButton
- With .chkPathMustExist
- .Caption := "Path Must Exist"
- .Move(1500, 2490, 2700, 300)
- .Value := "Checked"
- End With 'APISaveAsMasterForm.chkPathMustExist
- With .helpfile
- .FileName := "W:\Examples\apisavas\apisavas.hlp"
- End With 'APISaveAsMasterForm.helpfile
- End With 'APISaveAsMasterForm
- End Code
-