home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form MainForm
- Caption = "fpMemo"
- ClientHeight = 4815
- ClientLeft = 1140
- ClientTop = 1500
- ClientWidth = 7365
- Height = 5505
- Icon = FPNOTES.FRX:0000
- Left = 1080
- LinkTopic = "Form1"
- ScaleHeight = 3.344
- ScaleMode = 5 'Inch
- ScaleWidth = 5.115
- Top = 870
- Width = 7485
- Begin AwareMemo fpMemo
- BorderStyle = 0 'No Border
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Courier New"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 3015
- Left = 120
- LineLimit = 2147483647
- OnFocusPosition = 3 'Caret
- ScrollBars = 3 'Both (auto)
- TabIndex = 0
- ThreeDOutsideHighlightColor= &H00FFFFFF&
- Top = 120
- Width = 3015
- End
- Begin CommonDialog CMDialog1
- Left = 1200
- Top = 3660
- End
- Begin Menu MainMenu
- Caption = "&File"
- Index = 1
- Begin Menu FileMenu
- Caption = "&New"
- Index = 1
- End
- Begin Menu FileMenu
- Caption = "&Open"
- Index = 2
- End
- Begin Menu FileMenu
- Caption = "&Save"
- Index = 3
- End
- Begin Menu FileMenu
- Caption = "Save&As"
- Index = 4
- End
- Begin Menu FileMenu
- Caption = "&Print"
- Index = 5
- End
- Begin Menu FileMenu
- Caption = "E&xit"
- Index = 6
- End
- End
- Begin Menu MainMenu
- Caption = "&Edit"
- Index = 2
- Begin Menu EditMenu
- Caption = "&Undo"
- Enabled = 0 'False
- Index = 1
- End
- Begin Menu EditMenu
- Caption = "-"
- Index = 2
- End
- Begin Menu EditMenu
- Caption = "&Copy"
- Index = 3
- End
- Begin Menu EditMenu
- Caption = "Cu&t"
- Index = 4
- End
- Begin Menu EditMenu
- Caption = "&Paste"
- Index = 5
- End
- Begin Menu EditMenu
- Caption = "&Delete"
- Index = 6
- End
- End
- Begin Menu MainMenu
- Caption = "&Options"
- Index = 3
- Begin Menu OptionMenu
- Caption = "E&xtend Selection"
- Index = 1
- End
- Begin Menu OptionMenu
- Caption = "Show&EOL"
- Index = 2
- End
- Begin Menu OptionMenu
- Caption = "&WordWrap"
- Index = 3
- End
- End
- End
-
- Sub EditMenu_Click (index As Integer)
- Select Case (index)
- Case 1: 'Undo
- Case 3: fpmemo.Action = 0 'Copy
- Case 4: fpmemo.Action = 1 'Cut
- Case 5: fpmemo.Action = 2 'Paste
- Case 6: fpmemo.Action = 3 'Clear (Delete)
- End Select
- End Sub
-
- Sub FileMenu_Click (index As Integer)
- Dim SaveIt As Integer
-
- SaveIt = False
- If (gMemoChanged And index <> 3) Then
- SaveIt = MsgBox("Save changes?", MB_YESNOCANCEL)
- End If
-
- If (SaveIt = IDCANCEL) Then
- index = 0
- End If
-
- If (SaveIt = IDYES) Then
- ' save changes
- End If
-
- Select Case (index)
- Case 1: ' New
- fpmemo.Text = ""
- gMemoChanged = False
- gfilename = ""
- mainform.Caption = "<noname>"
- Case 2: ' Open
- OpenFile
- gMemoChanged = False
- Case 3: ' Save
- SaveFile
- gMemoChanged = False
- Case 4: ' SaveAs
- SaveFileAs
- gMemoChanged = False
- Case 5:
- PrintFile
- Case 6: ' Exit
- Unload mainform
- End Select
-
- End Sub
-
- Sub Form_Load ()
-
- fpmemo.Visible = False
-
- ' initialize global variables
- '
- gMemoChanged = False
- gfilename = ""
-
- End Sub
-
- Sub Form_Resize ()
- fpmemo.Visible = False
- fpmemo.Redraw = False
- fpmemo.Left = 0
- fpmemo.Top = 0
- fpmemo.Width = mainform.ScaleWidth
- fpmemo.Height = mainform.ScaleHeight
- fpmemo.Redraw = True
- fpmemo.Visible = True
- End Sub
-
- Sub fpMemo_Change ()
- gMemoChanged = True
- End Sub
-
- Sub MainMenu_Click (index As Integer)
- Dim IsSelected As Integer
- If (index = 1) Then
- filemenu(3).Enabled = gMemoChanged
- filemenu(4).Enabled = gMemoChanged Or (gfilename <> "")
- End If
- If (index = 2) Then
- IsSelected = (fpmemo.SelLength > 0)
- editmenu(3).Enabled = IsSelected
- editmenu(4).Enabled = IsSelected
- editmenu(5).Enabled = (clipboard.GetText() <> "")
- editmenu(6).Enabled = IsSelected
- End If
- End Sub
-
- Sub OpenFile ()
- Dim fname As String
-
- cmdialog1.Filter = "*.txt(Text Files)"
- cmdialog1.FilterIndex = 0
- cmdialog1.DefaultExt = ".txt"
- If (gfilename <> "") Then
- cmdialog1.Filename = gfilename
- Else
- cmdialog1.Filename = "*.txt"
- End If
- cmdialog1.Flags = &H1000& 'file must exist
- cmdialog1.DialogTitle = "Load File"
-
- cmdialog1.CancelError = True
-
- On Error Resume Next
-
- cmdialog1.Action = 1
- fname = cmdialog1.Filename
-
- Call LoadFile(fpmemo, fname)
- gfilename = fname
- mainform.Caption = gfilename
-
- End Sub
-
- Sub OptionMenu_Click (index As Integer)
- Select Case index
- Case 1: ' Extended Selection
- If (fpmemo.SelMode = 0) Then
- fpmemo.SelMode = 1
- optionmenu(1).Checked = True
- Else
- fpmemo.SelMode = 0
- optionmenu(1).Checked = False
- End If
- Case 2:
- If (fpmemo.ShowEOL = True) Then
- fpmemo.ShowEOL = False
- optionmenu(2).Checked = False
- Else
- fpmemo.ShowEOL = True
- optionmenu(2).Checked = True
- End If
- Case 3:
- If (fpmemo.WordWrap = True) Then
- fpmemo.WordWrap = False
- optionmenu(3).Checked = False
- Else
- fpmemo.WordWrap = True
- optionmenu(3).Checked = True
- End If
- End Select
- End Sub
-
- Sub PrintFile ()
- ' Print file using "line mode" to retrieve one line
- ' at a time using the Text property (and write it
- ' to the printer)
- '
-
- fpmemo.TextMode = 3
- Load PrintDialog
- PrintDialog.Show modeless
- On Error GoTo printerror
- For i = 0 To fpmemo.LineCount
- fpmemo.LineIndex = i
- printer.Print fpmemo.Text
- Next i
- printer.NewPage
- printer.EndDoc
-
- printquit:
- Unload PrintDialog
- Exit Sub
-
- printerror:
- Resume printquit
-
- End Sub
-
- Sub SaveFile ()
-
- Dim fname As String
-
- If (gfilename = "") Then
- cmdialog1.DefaultExt = ".txt"
- cmdialog1.Flags = &H800&
- cmdialog1.DialogTitle = "Save File"
- cmdialog1.Action = 2
- End If
-
- If (cmdialog1.Filename <> "") Then
- gfilename = cmdialog1.Filename
- mainform.Caption = gfilename
- Call WriteFile(fpmemo, gfilename)
- End If
-
- End Sub
-
- Sub SaveFileAs ()
-
- Dim fname As String
-
- cmdialog1.DefaultExt = ".txt"
- cmdialog1.Flags = &H800&
- cmdialog1.DialogTitle = "Save File As"
-
- cmdialog1.Action = 2
-
- If (cmdialog1.Filename <> "") Then
- gfilename = cmdialog1.Filename
- mainform.Caption = gfilename
- Call WriteFile(fpmemo, gfilename)
- End If
-
- End Sub
-
-