home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of Windows 95.com 1996 September
/
WIN95_09964.iso
/
text
/
DANA104.ZIP
/
INPUT.DAS
< prev
next >
Wrap
Text File
|
1995-12-21
|
1KB
|
74 lines
'
' Usual string input menu.
'
Const cFileName = "Input.LST"
Dim hMenu%, hMenu2%
Main ()
Dim fp%, nRC%
Dim ins$
Dim bBrk%
Do
LoadMenu()
nRC = DoMenu(hMenu)
Select Case nRC
Case -1
bBrk = True
Case 1000
'Register a string.
ins$ = InputBox("Input a string to register.", "", "")
If Ins$ <> "" Then
fp = FOpen(.HomePath + cFileName, "w")
If fp <> 0 Then
FSeek(fp, 0, 1)
FPuts(fp, ins$ + Chr(10))
FClose(fp)
Else
MsgBox("File open was failed.", "", 0)
End If
End If
Case 1001
'Edit using the editor.
FileOpen(.HomePath + cFileName, False)
bBrk = True
Case 1002
'Delete all.
FKill(.HomePath + cFileName)
Case 1003
bBrk = True
Case Else
InsertString(GetMenuItem(hMenu, nRC))
bBrk = True
End Select
DiscardMenu(hMenu2)
DiscardMenu(hMenu)
Loop Until bBrk = True
End
Proc LoadMenu()
Dim fp%
fp = FOpen(.HomePath + cFileName, "r")
hMenu = NewMenu()
if fp <> 0 Then
Dim ins$
Dim I%
ins$ = FGets(fp)
Do While ins$ <> ""
If ins$ <> Chr(10) Then
I = I + 1
AddMenuItem(hMenu, Left$(ins$, Len(ins$)-1), I)
End If
ins$ = FGets(fp)
Loop
FClose(fp)
End If
AddMenuItem(hMenu, "", -1)
Dim hMenu2%
hMenu2 = AddMenuItem(hMenu, "&Edit", 0)
AddMenuItem(hMenu2, "&Add", 1000)
AddMenuItem(hMenu2, "&Edit", 1001)
AddMenuItem(hMenu2, "&Delete All", 1002)
AddMenuItem(hMenu, "&Cancel", 1003)
End Proc