home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap25 / mdi / mdi.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-12  |  12.9 KB  |  368 lines

  1. VERSION 4.00
  2. Begin VB.MDIForm frmMDI 
  3.    BackColor       =   &H8000000C&
  4.    Caption         =   "MDI NotePad"
  5.    ClientHeight    =   3495
  6.    ClientLeft      =   915
  7.    ClientTop       =   2205
  8.    ClientWidth     =   7860
  9.    Height          =   4185
  10.    Left            =   855
  11.    LinkTopic       =   "MDIForm1"
  12.    Top             =   1575
  13.    Width           =   7980
  14.    Begin VB.PictureBox picToolbar 
  15.       Align           =   1  'Align Top
  16.       BeginProperty Font 
  17.          name            =   "MS Sans Serif"
  18.          charset         =   1
  19.          weight          =   700
  20.          size            =   8.25
  21.          underline       =   0   'False
  22.          italic          =   0   'False
  23.          strikethrough   =   0   'False
  24.       EndProperty
  25.       Height          =   405
  26.       Left            =   0
  27.       ScaleHeight     =   345
  28.       ScaleWidth      =   7800
  29.       TabIndex        =   0
  30.       Top             =   0
  31.       Width           =   7860
  32.       Begin MSComDlg.CommonDialog CMDialog1 
  33.          Left            =   1995
  34.          Top             =   0
  35.          _version        =   65536
  36.          _extentx        =   847
  37.          _extenty        =   847
  38.          _stockprops     =   0
  39.          cancelerror     =   -1  'True
  40.          defaultext      =   "TXT"
  41.          filter          =   "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
  42.       End
  43.       Begin VB.Image imgPasteButtonUp 
  44.          Height          =   330
  45.          Left            =   5280
  46.          Picture         =   "MDI.frx":0000
  47.          Top             =   0
  48.          Visible         =   0   'False
  49.          Width           =   375
  50.       End
  51.       Begin VB.Image imgPasteButtonDn 
  52.          Height          =   330
  53.          Left            =   4920
  54.          Picture         =   "MDI.frx":01E2
  55.          Top             =   0
  56.          Visible         =   0   'False
  57.          Width           =   375
  58.       End
  59.       Begin VB.Image imgCopyButtonDn 
  60.          Height          =   330
  61.          Left            =   4200
  62.          Picture         =   "MDI.frx":03C4
  63.          Top             =   0
  64.          Visible         =   0   'False
  65.          Width           =   375
  66.       End
  67.       Begin VB.Image imgCopyButtonUp 
  68.          Height          =   330
  69.          Left            =   4560
  70.          Picture         =   "MDI.frx":05A6
  71.          Top             =   0
  72.          Visible         =   0   'False
  73.          Width           =   375
  74.       End
  75.       Begin VB.Image imgCutButtonDn 
  76.          Height          =   330
  77.          Left            =   3840
  78.          Picture         =   "MDI.frx":0788
  79.          Top             =   0
  80.          Visible         =   0   'False
  81.          Width           =   375
  82.       End
  83.       Begin VB.Image imgCutButtonUp 
  84.          Height          =   330
  85.          Left            =   3480
  86.          Picture         =   "MDI.frx":096A
  87.          Top             =   0
  88.          Visible         =   0   'False
  89.          Width           =   375
  90.       End
  91.       Begin VB.Image imgFileOpenButtonDn 
  92.          Height          =   330
  93.          Left            =   2760
  94.          Picture         =   "MDI.frx":0B4C
  95.          Top             =   0
  96.          Visible         =   0   'False
  97.          Width           =   360
  98.       End
  99.       Begin VB.Image imgFileOpenButtonUp 
  100.          Height          =   330
  101.          Left            =   3120
  102.          Picture         =   "MDI.frx":0CD6
  103.          Top             =   0
  104.          Visible         =   0   'False
  105.          Width           =   360
  106.       End
  107.       Begin VB.Image imgFileNewButtonUp 
  108.          Height          =   330
  109.          Left            =   2400
  110.          Picture         =   "MDI.frx":0E60
  111.          Top             =   0
  112.          Visible         =   0   'False
  113.          Width           =   360
  114.       End
  115.       Begin VB.Image imgFileNewButtonDn 
  116.          Height          =   330
  117.          Left            =   2040
  118.          Picture         =   "MDI.frx":0FEA
  119.          Top             =   0
  120.          Visible         =   0   'False
  121.          Width           =   375
  122.       End
  123.       Begin VB.Image imgPasteButton 
  124.          Height          =   330
  125.          Left            =   1560
  126.          Picture         =   "MDI.frx":11CC
  127.          Top             =   0
  128.          Width           =   375
  129.       End
  130.       Begin VB.Image imgCopyButton 
  131.          Height          =   330
  132.          Left            =   1200
  133.          Picture         =   "MDI.frx":13AE
  134.          Top             =   0
  135.          Width           =   375
  136.       End
  137.       Begin VB.Image imgCutButton 
  138.          Height          =   330
  139.          Left            =   840
  140.          Picture         =   "MDI.frx":1590
  141.          Top             =   0
  142.          Width           =   375
  143.       End
  144.       Begin VB.Image imgFileOpenButton 
  145.          Height          =   330
  146.          Left            =   360
  147.          Picture         =   "MDI.frx":1772
  148.          Top             =   0
  149.          Width           =   360
  150.       End
  151.       Begin VB.Image imgFileNewButton 
  152.          Height          =   330
  153.          Left            =   0
  154.          Picture         =   "MDI.frx":18FC
  155.          Top             =   0
  156.          Width           =   360
  157.       End
  158.    End
  159.    Begin VB.Menu mnuFile 
  160.       Caption         =   "&File"
  161.       Begin VB.Menu mnuFNew 
  162.          Caption         =   "&New"
  163.       End
  164.       Begin VB.Menu mnuFOpen 
  165.          Caption         =   "&Open"
  166.       End
  167.       Begin VB.Menu mnuFExit 
  168.          Caption         =   "E&xit"
  169.       End
  170.       Begin VB.Menu mnuSeparator 
  171.          Caption         =   "-"
  172.       End
  173.       Begin VB.Menu mnuRecentFile 
  174.          Caption         =   "-"
  175.          Index           =   0
  176.          Visible         =   0   'False
  177.       End
  178.       Begin VB.Menu mnuRecentFile 
  179.          Caption         =   "RecentFile1"
  180.          Index           =   1
  181.          Visible         =   0   'False
  182.       End
  183.       Begin VB.Menu mnuRecentFile 
  184.          Caption         =   "RecentFile2"
  185.          Index           =   2
  186.          Visible         =   0   'False
  187.       End
  188.       Begin VB.Menu mnuRecentFile 
  189.          Caption         =   "RecentFile3"
  190.          Index           =   3
  191.          Visible         =   0   'False
  192.       End
  193.       Begin VB.Menu mnuRecentFile 
  194.          Caption         =   "RecentFile4"
  195.          Index           =   4
  196.          Visible         =   0   'False
  197.       End
  198.    End
  199.    Begin VB.Menu mnuOptions 
  200.       Caption         =   "&Options"
  201.       Begin VB.Menu mnuOToolbar 
  202.          Caption         =   "&Toolbar"
  203.       End
  204.    End
  205. Attribute VB_Name = "frmMDI"
  206. Attribute VB_Creatable = False
  207. Attribute VB_Exposed = False
  208. Private Sub imgCopyButton_Click()
  209.     imgcopybutton.Refresh
  210.     EditCopyProc
  211. End Sub
  212. Private Sub imgCopyButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  213.     imgcopybutton.Picture = imgCopyButtonDn.Picture
  214. End Sub
  215. Private Sub imgCopyButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
  216.     ' If the button is pressed, display the up bitmap when the
  217.     ' mouse is dragged outside the button's area; otherwise
  218.     ' display the down bitmap.
  219.     Select Case Button
  220.     Case 1
  221.         If x <= 0 Or x > imgcopybutton.Width Or Y < 0 Or Y > imgcopybutton.Height Then
  222.             imgcopybutton.Picture = imgCopyButtonUp.Picture
  223.         Else
  224.             imgcopybutton.Picture = imgCopyButtonDn.Picture
  225.         End If
  226.     End Select
  227. End Sub
  228. Private Sub imgCopyButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
  229.     imgcopybutton.Picture = imgCopyButtonUp.Picture
  230. End Sub
  231. Private Sub imgCutButton_Click()
  232.     imgcutbutton.Refresh
  233.     EditCutProc
  234. End Sub
  235. Private Sub imgCutButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  236.     imgcutbutton.Picture = imgCutButtonDn.Picture
  237. End Sub
  238. Private Sub imgCutButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
  239.     ' If the button is pressed, display the up bitmap when the
  240.     ' mouse is dragged outside the button's area; otherwise,
  241.     ' display the down bitmap.
  242.     Select Case Button
  243.     Case 1
  244.         If x <= 0 Or x > imgcutbutton.Width Or Y < 0 Or Y > imgcutbutton.Height Then
  245.             imgcutbutton.Picture = imgCutButtonUp.Picture
  246.         Else
  247.             imgcutbutton.Picture = imgCutButtonDn.Picture
  248.         End If
  249.     End Select
  250. End Sub
  251. Private Sub imgCutButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
  252.     imgcutbutton.Picture = imgCutButtonUp.Picture
  253. End Sub
  254. Private Sub imgFileNewButton_Click()
  255.     imgFileNewButton.Refresh
  256.     FileNew
  257. End Sub
  258. Private Sub imgFileNewButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  259.     imgFileNewButton.Picture = imgFileNewButtonDn.Picture
  260. End Sub
  261. Private Sub imgFileNewButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
  262.     ' If the button is pressed, display the up bitmap when the
  263.     ' mouse is dragged outside the button's area; otherwise,
  264.     ' display the down bitmap.
  265.     Select Case Button
  266.     Case 1
  267.         If x <= 0 Or x > imgFileNewButton.Width Or Y < 0 Or Y > imgFileNewButton.Height Then
  268.             imgFileNewButton.Picture = imgFileNewButtonUp.Picture
  269.         Else
  270.             imgFileNewButton.Picture = imgFileNewButtonDn.Picture
  271.         End If
  272.     End Select
  273. End Sub
  274. Private Sub imgFileNewButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
  275.     imgFileNewButton.Picture = imgFileNewButtonUp.Picture
  276. End Sub
  277. Private Sub imgFileOpenButton_Click()
  278.     imgFileOpenButton.Refresh
  279.     FOpenProc
  280. End Sub
  281. Private Sub imgFileOpenButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  282.     imgFileOpenButton.Picture = imgFileOpenButtonDn.Picture
  283. End Sub
  284. Private Sub imgFileOpenButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
  285.     ' If the button is pressed, display the up bitmap when the
  286.     ' mouse is dragged outside the button's area; otherwise,
  287.     ' display the down bitmap.
  288.     Select Case Button
  289.     Case 1
  290.         If x <= 0 Or x > imgFileOpenButton.Width Or Y < 0 Or Y > imgFileOpenButton.Height Then
  291.             imgFileOpenButton.Picture = imgFileOpenButtonUp.Picture
  292.         Else
  293.             imgFileOpenButton.Picture = imgFileOpenButtonDn.Picture
  294.         End If
  295.     End Select
  296. End Sub
  297. Private Sub imgFileOpenButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
  298.     imgFileOpenButton.Picture = imgFileOpenButtonUp.Picture
  299. End Sub
  300. Private Sub imgPasteButton_Click()
  301.     imgPasteButton.Refresh
  302.     EditPasteProc
  303. End Sub
  304. Private Sub imgPasteButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  305.     imgPasteButton.Picture = imgPasteButtonDn.Picture
  306. End Sub
  307. Private Sub imgPasteButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
  308.     ' If the button is pressed, display the up bitmap when the
  309.     ' mouse is dragged outside the button's area; otherwise,
  310.     ' display the down bitmap.
  311.     Select Case Button
  312.     Case 1
  313.         If x <= 0 Or x > imgPasteButton.Width Or Y < 0 Or Y > imgPasteButton.Height Then
  314.             imgPasteButton.Picture = imgPasteButtonUp.Picture
  315.         Else
  316.             imgPasteButton.Picture = imgPasteButtonDn.Picture
  317.         End If
  318.     End Select
  319. End Sub
  320. Private Sub imgPasteButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
  321.     imgPasteButton.Picture = imgPasteButtonUp.Picture
  322. End Sub
  323. Private Sub MDIForm_Load()
  324.     ' Application starts here (Load event of Startup form).
  325.     Show
  326.     ' Always set the working directory to the directory containing the application.
  327.     ChDir App.Path
  328.     ' Initialize the document form array, and show the first document.
  329.     ReDim Document(1)
  330.     ReDim FState(1)
  331.     Document(1).Tag = 1
  332.     FState(1).Dirty = False
  333.     ' Read System registry and set the recent menu file list control array appropriately.
  334.     GetRecentFiles
  335.     ' Set global variable gFindDirection which determines which direction
  336.     ' the FindIt function will search in.
  337.     gFindDirection = 1
  338. End Sub
  339. Private Sub MDIForm_Unload(Cancel As Integer)
  340.     ' If the Unload event was not cancelled (in the QueryUnload events for the Notepad forms),
  341.     ' there will be no document window left, so go ahead and end the application.
  342.     If Not AnyPadsLeft() Then
  343.         End
  344.     End If
  345. End Sub
  346. Private Sub mnuFExit_Click()
  347.     End
  348. End Sub
  349. Private Sub mnuFileSend_Click()
  350. End Sub
  351. Private Sub mnuFNew_Click()
  352.     FileNew
  353. End Sub
  354. Private Sub mnuFOpen_Click()
  355.     FOpenProc
  356. End Sub
  357. Private Sub mnuOptions_Click()
  358.     mnuOToolbar.Checked = frmMDI!picToolbar.Visible
  359. End Sub
  360. Private Sub mnuOToolbar_Click()
  361.     OptionsToolbarProc Me
  362. End Sub
  363. Private Sub mnuRecentFile_Click(index As Integer)
  364.     OpenFile (mnuRecentFile(index).Caption)
  365.     ' Update the list of the most recently opened files.
  366.     GetRecentFiles
  367. End Sub
  368.