home *** CD-ROM | disk | FTP | other *** search
/ The Best of Select: Windows 95 Special 2 / WIN95_2.bin / utils / envelop / envelop.6 / Tools / Bootcamp / basic / apiopen / apiopen.eto < prev    next >
Encoding:
Text File  |  1996-07-08  |  9.5 KB  |  308 lines

  1. Type APIFileOpenMasterForm From SampleMasterForm
  2.   Dim btnOpen As New Button
  3.   Dim Label1 As New Label
  4.   Dim Label2 As New Label
  5.   Dim lblFilePath As New Label
  6.   Dim Label3 As New Label
  7.   Dim lblFileName As New Label
  8.   Dim Label5 As New Label
  9.   Dim lblDirectory As New Label
  10.   Dim OpenPanel As New OpenDialog
  11.   Dim Label4 As New Label
  12.   Dim txtTitle As New TextBox
  13.   Dim Label6 As New Label
  14.   Dim optBmpFiles As New OptionButton
  15.   Dim optTextFiles As New OptionButton
  16.   Dim optExecutables As New OptionButton
  17.   Dim optAllFiles As New OptionButton
  18.   Dim Label7 As New Label
  19.   Dim chkFileMustExist As New CheckBox
  20.   Dim chkNoChangeDir As New CheckBox
  21.   Dim chkNoNetworkButton As New CheckBox
  22.   Dim chkPathMustExist As New CheckBox
  23.   Dim FileObject As New File
  24.   Dim Label8 As New Label
  25.   Dim lblFileSize As New Label
  26.   Dim Label9 As New Label
  27.   Dim lblFileExtension As New Label
  28.   Dim Label11 As New Label
  29.   Dim lblFileDate As New Label
  30.   Dim Label13 As New Label
  31.   Dim lblFileTime As New Label
  32.  
  33.   ' METHODS for object: APIFileOpenMasterForm
  34.   Sub optExecutables_Click()
  35.     OpenPanel.Filter = "Executable files (*.exe)|*.exe|"
  36.   End Sub
  37.  
  38.   Sub optTextFiles_Click()
  39.     OpenPanel.Filter = "Text files (*.txt)|*.txt|Script files (*.bat)|*.bat|System files (*.sys)|*.sys|Config files (*.ini)|*.ini|"
  40.   End Sub
  41.  
  42.   Sub optAllFiles_Click()
  43.     OpenPanel.Filter = "All files (*.*)|*.*|"
  44.   End Sub
  45.  
  46.   Sub optBmpFiles_Click()
  47.     OpenPanel.Filter = "Bitmap files (*.bmp)|*.bmp|"
  48.   End Sub
  49.  
  50.   Sub chkFileMustExist_Click()
  51.     If chkFileMustExist.Value == 0 Then 
  52.       OpenPanel.FileMustExist = "False"
  53.     Else 
  54.       OpenPanel.FileMustExist = "True"
  55.     End If
  56.   End Sub
  57.  
  58.   Sub chkNoChangeDir_Click()
  59.     If chkNoChangeDir.Value == 0 Then 
  60.       OpenPanel.NoChangeDir = "False"
  61.     Else 
  62.       OpenPanel.NoChangeDir = "True"
  63.     End If
  64.   End Sub
  65.  
  66.   Sub chkNoNetworkButton_Click()
  67.     If chkNoNetworkButton.Value == 0 Then 
  68.       OpenPanel.NoNetworkButton = "False"
  69.     Else 
  70.       OpenPanel.NoNetworkButton = "True"
  71.     End If
  72.   End Sub
  73.  
  74.   Sub chkPathMustExist_Click()
  75.     If chkPathMustExist.Value == 0 Then 
  76.       OpenPanel.PathMustExist = "False"
  77.     Else 
  78.       OpenPanel.PathMustExist = "True"
  79.     End If
  80.   End Sub
  81.  
  82.   Sub btnOpen_Click()
  83.     Dim length As Integer
  84.     Dim IDCANCEL As Integer
  85.   
  86.     ' IDCANCEL is also defined in USER32.PHO
  87.     IDCANCEL = 2
  88.   
  89.     ' Set the title of the open dialog just before we display it.
  90.     OpenPanel.Title = txtTitle.Text
  91.   
  92.     ' Set the initial dir and filename to previous selection (or empty).
  93.     OpenPanel.InitialDir = lblFilePath.Text
  94.     OpenPanel.FileName = lblFileName.Text & lblFileExtension.Text
  95.   
  96.     ' If a filename was picked, then display selected file information.
  97.     If OpenPanel.Execute <> IDCANCEL Then 
  98.       FileObject.FileName = OpenPanel.FileName
  99.       lblFilePath.Text = FileObject.FileName
  100.       lblDirectory.Text = FileObject.Path
  101.       lblFileName.Text = FileObject.Name
  102.       lblFileSize.Text = FileObject.Size
  103.       lblFileExtension.Text = FileObject.Extension
  104.       lblFileDate.Text = FileObject.Date
  105.       lblFileTime.Text = FileObject.Time
  106.     Else 
  107.       lblFilePath.Text = ""
  108.       lblDirectory.Text = ""
  109.       lblFileName.Text = ""
  110.       lblFileSize.Text = ""
  111.       lblFileExtension.Text = ""
  112.       lblFileDate.Text = ""
  113.       lblFileTime.Text = ""
  114.     End If
  115.   End Sub
  116.  
  117.   Sub ResetApplication_Click ()
  118.   
  119.     ' Initialize Open Dialog Demonstration
  120.   
  121.     optBmpFiles.Value = False
  122.     optTextFiles.Value = False
  123.     optExecutables.Value = False
  124.     optAllFiles.Value = True
  125.   
  126.     ' Set open panel defaults
  127.     OpenPanel.Filter = "All files (*.*)|*.*|"
  128.   
  129.     OpenPanel.FileMustExist = "True"
  130.     OpenPanel.NoChangeDir = "False"
  131.     OpenPanel.NoNetworkButton = "False"
  132.     OpenPanel.PathMustExist = "True"
  133.   
  134.     ' Set the checkbox defaults
  135.     chkFileMustExist.Value = 1
  136.     chkNoChangeDir.Value = 0
  137.     chkNoNetworkButton.Value = 0
  138.     chkPathMustExist.Value = 1
  139.   
  140.     ' Clear out the file/directory labels
  141.     lblDirectory.Text = ""
  142.     lblFileName.Text = ""
  143.     lblFilePath.Text = ""
  144.     lblFileSize.Text = ""
  145.     lblFileExtension.Text = ""
  146.     lblFileDate.Text = ""
  147.     lblFileTime.Text = ""
  148.   
  149.   End Sub
  150.  
  151. End Type
  152.  
  153. Begin Code
  154. ' Reconstruction commands for object: APIFileOpenMasterForm
  155. '
  156.   With APIFileOpenMasterForm
  157.     .Caption := "Windows Open Dialog Demonstration"
  158.     .Move(6315, 1245, 7800, 7215)
  159.     .CurrentY := 64
  160.     .DefaultButton := APIFileOpenMasterForm.btnOpen
  161.     .SampleDir := "W:\examples\apiopen\"
  162.     .SampleName := "apiopen"
  163.     With .btnOpen
  164.       .Caption := "&Open"
  165.       .Move(3150, 5850, 1800, 450)
  166.     End With  'APIFileOpenMasterForm.btnOpen
  167.     With .Label1
  168.       .Caption := "1. Select options below then choose ""Open"" to select a file."
  169.       .ForeColor := 13107200
  170.       .Move(300, 300, 5850, 300)
  171.     End With  'APIFileOpenMasterForm.Label1
  172.     With .Label2
  173.       .Caption := "FileName:"
  174.       .Move(255, 3450, 1140, 300)
  175.       .Alignment := "Right"
  176.     End With  'APIFileOpenMasterForm.Label2
  177.     With .lblFilePath
  178.       .BackColor := 16777215
  179.       .Move(1500, 3450, 5850, 300)
  180.       .BorderStyle := "Fixed Single"
  181.     End With  'APIFileOpenMasterForm.lblFilePath
  182.     With .Label3
  183.       .Caption := "Name:"
  184.       .Move(285, 4275, 1110, 300)
  185.       .Alignment := "Right"
  186.     End With  'APIFileOpenMasterForm.Label3
  187.     With .lblFileName
  188.       .BackColor := 16777215
  189.       .Move(1500, 4290, 5850, 300)
  190.       .BorderStyle := "Fixed Single"
  191.     End With  'APIFileOpenMasterForm.lblFileName
  192.     With .Label5
  193.       .Caption := "Path:"
  194.       .Move(255, 3855, 1140, 300)
  195.       .Alignment := "Right"
  196.     End With  'APIFileOpenMasterForm.Label5
  197.     With .lblDirectory
  198.       .BackColor := 16777215
  199.       .Move(1500, 3855, 5850, 300)
  200.       .BorderStyle := "Fixed Single"
  201.     End With  'APIFileOpenMasterForm.lblDirectory
  202.     With .OpenPanel
  203.       .FileName := "W:\bin\appstub.EXE"
  204.       .Filter := "All files (*.*)|*.*|"
  205.       .InitialDir := "W:\ALLOBJS.TXT"
  206.     End With  'APIFileOpenMasterForm.OpenPanel
  207.     With .Label4
  208.       .Caption := "Title:"
  209.       .Move(300, 960, 600, 300)
  210.     End With  'APIFileOpenMasterForm.Label4
  211.     With .txtTitle
  212.       .Move(945, 900, 6405, 360)
  213.     End With  'APIFileOpenMasterForm.txtTitle
  214.     With .Label6
  215.       .Caption := "Filter:"
  216.       .Move(300, 1500, 1500, 300)
  217.     End With  'APIFileOpenMasterForm.Label6
  218.     With .optBmpFiles
  219.       .Caption := "&Bitmap Files [*.BMP]"
  220.       .Move(450, 1800, 2700, 300)
  221.       .TabGroup := True
  222.     End With  'APIFileOpenMasterForm.optBmpFiles
  223.     With .optTextFiles
  224.       .Caption := "&Text Files [*.TXT, *.BAT, *.SYS, *.INI]"
  225.       .Move(450, 2100, 3900, 300)
  226.     End With  'APIFileOpenMasterForm.optTextFiles
  227.     With .optExecutables
  228.       .Caption := "&Executables [*.EXE]"
  229.       .Move(450, 2400, 2700, 300)
  230.     End With  'APIFileOpenMasterForm.optExecutables
  231.     With .optAllFiles
  232.       .Caption := "&All Files [*.*]"
  233.       .Move(450, 2700, 2700, 300)
  234.       .TabStop := True
  235.       .Value := True
  236.     End With  'APIFileOpenMasterForm.optAllFiles
  237.     With .Label7
  238.       .Caption := "Options:"
  239.       .Move(4500, 1500, 1500, 300)
  240.     End With  'APIFileOpenMasterForm.Label7
  241.     With .chkFileMustExist
  242.       .Caption := "File Must E&xist"
  243.       .Move(4635, 1815, 2700, 300)
  244.       .TabGroup := True
  245.       .Value := "Checked"
  246.     End With  'APIFileOpenMasterForm.chkFileMustExist
  247.     With .chkNoChangeDir
  248.       .Caption := "No &Change Directory"
  249.       .Move(4635, 2115, 2700, 300)
  250.     End With  'APIFileOpenMasterForm.chkNoChangeDir
  251.     With .chkNoNetworkButton
  252.       .Caption := "No &Network Button"
  253.       .Move(4635, 2415, 2700, 300)
  254.     End With  'APIFileOpenMasterForm.chkNoNetworkButton
  255.     With .chkPathMustExist
  256.       .Caption := "&Path Must Exist"
  257.       .Move(4635, 2715, 2700, 300)
  258.       .Value := "Checked"
  259.     End With  'APIFileOpenMasterForm.chkPathMustExist
  260.     With .FileObject
  261.       .FileName := "W:\bin\appstub.EXE"
  262.     End With  'APIFileOpenMasterForm.FileObject
  263.     With .Label8
  264.       .Caption := "Size:"
  265.       .Move(255, 5235, 1140, 300)
  266.       .Alignment := "Right"
  267.     End With  'APIFileOpenMasterForm.Label8
  268.     With .lblFileSize
  269.       .BackColor := 16777215
  270.       .Move(1500, 5235, 1650, 300)
  271.       .BorderStyle := "Fixed Single"
  272.     End With  'APIFileOpenMasterForm.lblFileSize
  273.     With .Label9
  274.       .Caption := "Extension:"
  275.       .Move(270, 4785, 1125, 300)
  276.       .Alignment := "Right"
  277.     End With  'APIFileOpenMasterForm.Label9
  278.     With .lblFileExtension
  279.       .BackColor := 16777215
  280.       .Move(1500, 4785, 1665, 300)
  281.       .BorderStyle := "Fixed Single"
  282.     End With  'APIFileOpenMasterForm.lblFileExtension
  283.     With .Label11
  284.       .Caption := "Last mod. date:"
  285.       .Move(3480, 4815, 1695, 300)
  286.       .Alignment := "Right"
  287.     End With  'APIFileOpenMasterForm.Label11
  288.     With .lblFileDate
  289.       .BackColor := 16777215
  290.       .Move(5250, 4800, 2100, 300)
  291.       .BorderStyle := "Fixed Single"
  292.     End With  'APIFileOpenMasterForm.lblFileDate
  293.     With .Label13
  294.       .Caption := "Last mod. time:"
  295.       .Move(3480, 5265, 1695, 300)
  296.       .Alignment := "Right"
  297.     End With  'APIFileOpenMasterForm.Label13
  298.     With .lblFileTime
  299.       .BackColor := 16777215
  300.       .Move(5250, 5250, 2100, 300)
  301.       .BorderStyle := "Fixed Single"
  302.     End With  'APIFileOpenMasterForm.lblFileTime
  303.     With .helpfile
  304.       .FileName := "W:\examples\apiopen\apiopen.hlp"
  305.     End With  'APIFileOpenMasterForm.helpfile
  306.   End With  'APIFileOpenMasterForm
  307. End Code
  308.