home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD Direkt 1995 #1
/
Image.iso
/
cdd
/
winanw2
/
spelmate
/
speltest.frm
< prev
next >
Wrap
Text File
|
1993-10-01
|
5KB
|
208 lines
VERSION 2.00
Begin Form Form1
BorderStyle = 3 'Fixed Double
Caption = "SpellMate Test"
Height = 5220
Icon = SPELTEST.FRX:0000
Left = 720
LinkTopic = "Form1"
ScaleHeight = 4530
ScaleWidth = 7770
Top = 960
Width = 7890
Begin TextBox Text1
Height = 4575
HideSelection = 0 'False
Left = 0
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 0
Text = "Text1"
Top = 0
Width = 7815
End
Begin Menu MnuFileMenu
Caption = "&File"
Begin Menu MnuNewFile
Caption = "New"
Shortcut = ^N
End
Begin Menu MnuOpenFile
Caption = "Open..."
Shortcut = ^O
End
Begin Menu MnuSaveFile
Caption = "Save"
Shortcut = ^S
End
Begin Menu MnuSaveAsFile
Caption = "Save As..."
Shortcut = ^A
End
Begin Menu MnuExitFile
Caption = "Exit"
Shortcut = ^X
End
End
Begin Menu SpellCheckIt
Caption = "&SpellCheck"
Begin Menu MnuSpellCrsr
Caption = "&Check From Cursor"
End
Begin Menu MnuCheckDoc
Caption = "Check &Document"
End
End
End
Option Explicit
Sub DoLoadFile (F$)
Dim fn%, l$, txt$, NL$, Ndx&
NL$ = Chr$(13) + Chr$(10)
Ndx& = 1
txt$ = Space$(64000)
fn% = FreeFile
If fn% > 0 Then
Open F$ For Input As #fn%
txt$ = ""
' Line Input #fn%, l$
Do Until EOF(fn%)
Line Input #fn%, l$
l$ = Space$(3) & l$ & NL$
If Ndx& + Len(l$) >= 64000 Then
Exit Do
Else
txt$ = RTrim$(txt$) + l$
Ndx& = Ndx& + Len(l$)
End If
Loop
Close #fn%
Text1.Text = RTrim$(txt$)
End If
FileChanged = False
End Sub
Sub DoSaveFile (F$)
Dim fn%
fn% = FreeFile
If fn% > 0 Then
Open F$ For Output Access Write As fn%
Print #fn%, (Text1.Text)
Close #fn%
FileChanged = False
Else
MsgBox "Could not save file."
End If
End Sub
Sub Form_Load ()
Text1.Text = ""
FileChanged = False
End Sub
Sub Form_Paint ()
Text1.SetFocus
End Sub
Sub MnuCheckDoc_Click ()
Text1.SelStart = 1
DoSpellCheck Text1
End Sub
Sub MnuExitFile_Click ()
If FileChanged Then
MnuSaveFile_Click
End If
End
End Sub
Sub MnuNewFile_Click ()
Dim s%
If FileChanged Then
s% = MsgBox("Save Current Text?", 35, "SpellMate Test")
Select Case s%
Case 6: ' Yes
MnuSaveFile_Click
Case 2: ' Cancel
Exit Sub
Case 7: ' No
' Do nothing.
End Select
End If
' Now delete existing text to start new file...
Text1.Text = ""
FileChanged = False
End Sub
Sub MnuOpenFile_Click ()
Dim s%
If FileChanged Then
s% = MsgBox("Save Existing Text?", 35, "Spelmate Test")
Select Case s%
Case 2: ' Cancel
Exit Sub
Case 6: ' Yes
' Save Existing Text...
If FullFilePath = "" Then
' Need to get a file name...
SaveFile.Show MODAL
If FullFilePath = "" Then
' Cancel pressed, so...
Exit Sub
End If
End If
DoSaveFile FullFilePath
Case 7: ' No
' Do nothing.
End Select
End If
' Now get the name of the file to open...
GetFile.Show MODAL
If FileSelected Then
MousePointer = 11
Text1.Text = ""
DoLoadFile FullFilePath
MousePointer = 0
Else
Exit Sub
End If
FileChanged = False
End Sub
Sub MnuSaveAsFile_Click ()
Dim fp$
fp$ = FullFilePath
SaveFile.Show MODAL
If FullFilePath = fp$ Then
' Cancel pressed, so...
Exit Sub
End If
MousePointer = 11
DoSaveFile FullFilePath
MousePointer = 0
End Sub
Sub MnuSaveFile_Click ()
If FullFilePath = "" Then
' Need to get a file name...
SaveFile.Show MODAL
If FullFilePath = "" Then
' Cancel pressed, so...
Exit Sub
End If
End If
MousePointer = 11
DoSaveFile FullFilePath
MousePointer = 0
End Sub
Sub MnuSpellCrsr_Click ()
DoSpellCheck Text1
End Sub
Sub Text1_Change ()
FileChanged = True
End Sub