home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / FERRAMEN / SPELMATE / SPEL.ZIP / SPELTEST.FR$ / speltest.frm (.txt)
Encoding:
Visual Basic Form  |  1993-10-01  |  4.9 KB  |  193 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "SpellMate Test"
  5.    Height          =   5220
  6.    Icon            =   SPELTEST.FRX:0000
  7.    Left            =   720
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   4530
  10.    ScaleWidth      =   7770
  11.    Top             =   960
  12.    Width           =   7890
  13.    Begin TextBox Text1 
  14.       Height          =   4575
  15.       HideSelection   =   0   'False
  16.       Left            =   0
  17.       MultiLine       =   -1  'True
  18.       ScrollBars      =   3  'Both
  19.       TabIndex        =   0
  20.       Text            =   "Text1"
  21.       Top             =   0
  22.       Width           =   7815
  23.    End
  24.    Begin Menu MnuFileMenu 
  25.       Caption         =   "&File"
  26.       Begin Menu MnuNewFile 
  27.          Caption         =   "New"
  28.          Shortcut        =   ^N
  29.       End
  30.       Begin Menu MnuOpenFile 
  31.          Caption         =   "Open..."
  32.          Shortcut        =   ^O
  33.       End
  34.       Begin Menu MnuSaveFile 
  35.          Caption         =   "Save"
  36.          Shortcut        =   ^S
  37.       End
  38.       Begin Menu MnuSaveAsFile 
  39.          Caption         =   "Save As..."
  40.          Shortcut        =   ^A
  41.       End
  42.       Begin Menu MnuExitFile 
  43.          Caption         =   "Exit"
  44.          Shortcut        =   ^X
  45.       End
  46.    End
  47.    Begin Menu SpellCheckIt 
  48.       Caption         =   "&SpellCheck"
  49.       Begin Menu MnuSpellCrsr 
  50.          Caption         =   "&Check From Cursor"
  51.       End
  52.       Begin Menu MnuCheckDoc 
  53.          Caption         =   "Check &Document"
  54.       End
  55.    End
  56. Option Explicit
  57. Sub DoLoadFile (F$)
  58. Dim fn%, l$, txt$, NL$, Ndx&
  59.     NL$ = Chr$(13) + Chr$(10)
  60.     Ndx& = 1
  61.     txt$ = Space$(64000)
  62.     fn% = FreeFile
  63.     If fn% > 0 Then
  64.         Open F$ For Input As #fn%
  65.         txt$ = ""
  66.         ' Line Input #fn%, l$
  67.         Do Until EOF(fn%)
  68.             Line Input #fn%, l$
  69.             l$ = Space$(3) & l$ & NL$
  70.             If Ndx& + Len(l$) >= 64000 Then
  71.                 Exit Do
  72.             Else
  73.                 txt$ = RTrim$(txt$) + l$
  74.                 Ndx& = Ndx& + Len(l$)
  75.             End If
  76.         Loop
  77.         Close #fn%
  78.         Text1.Text = RTrim$(txt$)
  79.     End If
  80.     FileChanged = False
  81. End Sub
  82. Sub DoSaveFile (F$)
  83. Dim fn%
  84.     fn% = FreeFile
  85.     If fn% > 0 Then
  86.         Open F$ For Output Access Write As fn%
  87.         Print #fn%, (Text1.Text)
  88.         Close #fn%
  89.         FileChanged = False
  90.     Else
  91.         MsgBox "Could not save file."
  92.     End If
  93. End Sub
  94. Sub Form_Load ()
  95.     Text1.Text = ""
  96.     FileChanged = False
  97. End Sub
  98. Sub Form_Paint ()
  99.     Text1.SetFocus
  100. End Sub
  101. Sub MnuCheckDoc_Click ()
  102.     Text1.SelStart = 1
  103.     DoSpellCheck Text1
  104. End Sub
  105. Sub MnuExitFile_Click ()
  106.     If FileChanged Then
  107.         MnuSaveFile_Click
  108.     End If
  109.     End
  110. End Sub
  111. Sub MnuNewFile_Click ()
  112. Dim s%
  113.     If FileChanged Then
  114.         s% = MsgBox("Save Current Text?", 35, "SpellMate Test")
  115.         Select Case s%
  116.             Case 6: ' Yes
  117.                 MnuSaveFile_Click
  118.             Case 2: ' Cancel
  119.                 Exit Sub
  120.             Case 7: ' No
  121.                 ' Do nothing.
  122.         End Select
  123.     End If
  124.     ' Now delete existing text to start new file...
  125.     Text1.Text = ""
  126.     FileChanged = False
  127. End Sub
  128. Sub MnuOpenFile_Click ()
  129. Dim s%
  130.     If FileChanged Then
  131.         s% = MsgBox("Save Existing Text?", 35, "Spelmate Test")
  132.         Select Case s%
  133.             Case 2: ' Cancel
  134.                 Exit Sub
  135.             Case 6: ' Yes
  136.                 ' Save Existing Text...
  137.                 If FullFilePath = "" Then
  138.                     ' Need to get a file name...
  139.                     SaveFile.Show MODAL
  140.                     If FullFilePath = "" Then
  141.                         ' Cancel pressed, so...
  142.                         Exit Sub
  143.                     End If
  144.                 End If
  145.                 DoSaveFile FullFilePath
  146.             Case 7: ' No
  147.                 ' Do nothing.
  148.         End Select
  149.     End If
  150.     ' Now get the name of the file to open...
  151.     GetFile.Show MODAL
  152.     If FileSelected Then
  153.         MousePointer = 11
  154.         Text1.Text = ""
  155.         DoLoadFile FullFilePath
  156.         MousePointer = 0
  157.     Else
  158.         Exit Sub
  159.     End If
  160.     FileChanged = False
  161. End Sub
  162. Sub MnuSaveAsFile_Click ()
  163. Dim fp$
  164.     fp$ = FullFilePath
  165.     SaveFile.Show MODAL
  166.     If FullFilePath = fp$ Then
  167.         ' Cancel pressed, so...
  168.         Exit Sub
  169.     End If
  170.     MousePointer = 11
  171.     DoSaveFile FullFilePath
  172.     MousePointer = 0
  173. End Sub
  174. Sub MnuSaveFile_Click ()
  175.     If FullFilePath = "" Then
  176.         ' Need to get a file name...
  177.         SaveFile.Show MODAL
  178.         If FullFilePath = "" Then
  179.             ' Cancel pressed, so...
  180.             Exit Sub
  181.         End If
  182.     End If
  183.     MousePointer = 11
  184.     DoSaveFile FullFilePath
  185.     MousePointer = 0
  186. End Sub
  187. Sub MnuSpellCrsr_Click ()
  188.     DoSpellCheck Text1
  189. End Sub
  190. Sub Text1_Change ()
  191.     FileChanged = True
  192. End Sub
  193.