Post by metro on Jan 8, 2020 3:32:27 GMT -5
Thanks to Ken Lewis Sr for the code, may be useful for someone
HINT .... save the program first before running it in the editor
'CONTACT MANAGER v4.25
'copyright 2004, Ken Lewis, Sr.
'This code is released as open source
'use of this program signifies acceptance of the following provision
'you accept full responsibility for any problems arising from
'the use, abuse, or modification of this program
'This program started as a demo program included with Liberty BASIC
'version 3.0 written by Carl Gundel, author of Liberty BASIC
'version 4.xx modifications by Ken Lewis, Sr.
'moved all code possible to subs and functions
'modified code to take advantage of LB 4 features
'version 4.01
'fixed bugs in retreiving record when filter was other than 'all'
'version 4.10
'added sort records by business name or city
'version 4.20
'added delete record only if filter was set to 'all'
'added edit stage list
'version 4.21
'fixed bug in find duplicates
'version 4.22
'added record numbers to listbox array
'thereby allowing delete record when filter was other than 'all'
'version 4.23
'added 'please wait' screens when program was busy processing
'version 4.24
'added help menu and associated code
'version 4.25
'repaired edit stage list
'repaired phone# length
'I have done nearly a complete rewrite to modify it to suit my needs
'and to take advantage of Liberty BASIC v4.xx features
'It now includes a sort function that will sort by the business name or city
'It also includes record deletion (Records are deleted on the fly)
'''''''''''''''''''''''''''''''''''''''''''''''
'Many thanks to Tom Nally and Alyce Watson....'
'Liberty BASIC Simple Help was the inspiration'
'for the help file in this program............'
'''''''''''''''''''''''''''''''''''''''''''''''
[Initialize]
Global hMain, hFind, dupNum, dupo, addName, recordIndex, contactCount
Global filterCount, oldStage$
Nomainwin
Dim name$(1000), nameSearch$(1000), dup$(500), stage$(20)
Dim builder$(1000, 13), existInfo$(10,10), hContents$(20)
If Not(exists("filter.lst")) Then 'first run create stage list
Open "filter.lst" For Output As #filter
Print #filter, 9
Print #filter, "All"
Print #filter, "Initial Phone Call"
Print #filter, "Opening Mailer"
Print #filter, "Follow Up Call"
Print #filter, "Meeting?"
Print #filter, "Next Phone Call"
Print #filter, "Quoted Job"
Print #filter, "Current Job"
Print #filter, "Finished Job"
Close #filter
End If
Open "filter.lst" For Input As #filter 'load stage list
Input #filter, filterCount
For filterIndex=0 to filterCount-1
Input #filter, filterName$
stage$(filterIndex)=filterName$
Next filterIndex
Close #filter
dupo=0
addName=1
Call loadNames
[GUI]
'set up our user interface
Stylebits #main.memo, _WS_VSCROLL, _ES_AUTOHSCROLL, _ES_MULTILINE, 0 '
Stylebits #main, 0,_WS_MAXIMIZEBOX,0,0
WindowWidth = 495 '595 695 795
WindowHeight = 460
UpperLeftX=Int((DisplayWidth-WindowWidth)/2)
UpperLeftY=Int((DisplayHeight-WindowHeight)/2)
'open the main window
Menu #main, "&File", "e&xit", [endProgram]
Menu #main, "&Records", "&new", [addRecord], "&sort", [sortem], _
"s&ave contact", [acceptEntry], "&delete contact", removeEntry
Menu #main, "&Edit", "stage &list", refilter
Menu #main, "&Help", "a&bout", coderInfo, "h&istory", versionInfo, _
"&help", helpInfo
Statictext #main, "Contacts", 10, 10, 60, 20
Listbox #main.contacts, name$(, modifyRecord, 10, 35, 160, 120
Statictext #main, "Filter Contacts", 10, 170, 160, 20
Combobox #main.filter, stage$(, loadNamesFiltered, 10, 190, 160, 120
Statictext #main, "Business", 195, 10, 50, 20
Textbox #main.name, 250, 10, 225, 25
Statictext #main, "Contact", 195, 40, 50, 20
Textbox #main.contact, 250, 40, 225, 25
Statictext #main, "Address", 195, 70, 50, 20
Textbox #main.addr, 250, 70, 225, 25
Statictext #main, "City", 195, 100, 50, 20
Textbox #main.city, 250, 100, 225, 25
Statictext #main, "State", 195, 130, 50, 20
Textbox #main.state, 250, 130, 40, 25
Statictext #main, "Zip", 325, 130, 30, 20
Textbox #main.zip, 365, 130, 108, 25
Statictext #main, "Phone #", 195, 160, 50, 20
Textbox #main.phone, 250, 160, 85, 25
Statictext #main, "Phone 2", 340, 160, 50, 20
Textbox #main.phone2, 390, 160, 85, 25
Statictext #main, "Fax #", 195, 190, 50, 20
Textbox #main.fax, 250, 190, 85, 25
Statictext #main, "Cell #", 340, 190, 50, 20
Textbox #main.cell, 390, 190, 85, 25
Statictext #main, "E-Mail", 195, 220, 50, 20
Textbox #main.email, 250, 220, 225, 25
Statictext #main, "Stage", 195, 250, 50, 20
Combobox #main.stage, stage$(, [inputLoop], 250, 250, 225, 110
Statictext #main, "Memo", 195, 280, 50, 20
Textbox #main.memo, 250, 280, 225, 60
Statictext #main, "Mailing Date:", 10, 240, 150, 20
Statictext #main.mailDate, "N/A", 10, 261, 150, 20
Statictext #main, "This record last modified:", 10, 300, 150, 20
Statictext #main.modDate, "N/A", 10, 321, 150, 20
Button #main.new, "&New Record", addRecord, UL, 10, 360
Button #main.find "Find D&uplicates", duplicateControl, UL, 165, 360
Listbox #main.namel, dup$(, pick, 490, 10, 190, 395
Button #main.OK, "S&ave Record", acceptEntry, UL, 370, 360
Open "Libby Contact Manager v4.25" For Window As #main
Print #main, "Trapclose endProgram"
Print #main.filter, "Select All";
Print #main.contacts, "SingleClickSelect"
Print #main.namel, "SingleClickSelect"
hMain=hwnd(#main)
hFind=hwnd(#main.find)
[Code]
Call noResize
Print #main.contacts, "Setfocus"
[inputLoop]
Wait
[acceptEntry]
Call acceptEntry handle$
Wait
[addRecord]
Call addRecord handle$
Wait
[sortem]
PopUpMenu "name sort", [byName], "city sort", [byCity]
Wait
[byName]
Call sortem 1
Wait
[byCity]
Call sortem 4
Wait
[endProgram]
Call endProgram handle$
Wait
Sub endProgram handle$
close #main
end
End Sub
Sub loadNames
If exists("contact4old.bak") Then
Kill "contact4old.bak"
End If
If exists("contact4.bak") Then
Name "contact4.bak" As "contact4old.bak"
End If
Open "contact4.dat" For Random As #contacts Len = 800
Field #contacts, 35 As name$, 35 As contact$, 35 As address$, 20 As city$, 2 As state$, _
10 As zip$, 15 As phone$,15 As phone2$,15 As fax$, 15 As cell$, 50 As email$, _
20 As stage$, 500 As memo$, 13 As moddate$, 13 As mailDate$, 7 As extra$
Open "contact4.bak" For Random As #contactsCopy Len = 800
Field #contactsCopy, 35 As name$, 35 As contact$, 35 As address$, 20 As city$, 2 As state$, _
10 As zip$, 15 As phone$,15 As phone2$,15 As fax$, 15 As cell$, 50 As email$, _
20 As stage$, 500 As memo$, 13 As moddate$, 13 As mailDate$, 7 As extra$
'if contact4.dat doesn't exist, we will create it with 0 records
If Eof(#contacts) <> 0 Then
Close #contacts
Close #contactsCopy
Call initializeNames
Goto [skipIt]
End If
'create a backup of the file each time we make a change
Get #contacts, 1
Put #contactsCopy, 1
contactCount = Val(name$)
If contactCount = 0 Then
Close #contacts
Close #contactsCopy
Goto [skipIt]
End If
For index = 2 To contactCount + 1
Gettrim #contacts, index
Put #contactsCopy, index
name$(index - 1) = str$(index-1)+") "+name$
Next index
Close #contacts
Close #contactsCopy
[skipIt]
End Sub
Sub initializeNames
'create the data file with 0 records
Open "contact4.dat" For Random As #contacts Len = 800
Field #contacts, 35 As name$, 35 As contact$, 35 As address$, 20 As city$, 2 As state$, _
10 As zip$, 15 As phone$,15 As phone2$,15 As fax$, 15 As cell$, 50 As email$, _
20 As stage$, 500 As memo$, 13 As moddate$, 13 As mailDate$, 7 As extra$
name$ = "0"
Put #contacts, 1
Close #contacts
End Sub
Sub noResize
'disable resizing of the window, because of the hidden duplicates control
Open "user32.dll" For Dll As #user
Calldll #user, "GetSystemMenu", _
hMain As Ulong, 0 As Ulong, hmenu As Ulong
' sysmenu.Restore=GetMenuItemID(hmenu,0)
' sysmenu.Move=GetMenuItemID(hmenu,1)
sysmenu.Size=GetMenuItemID(hmenu,2)
' sysmenu.Minimize=GetMenuItemID(hmenu,3)
sysmenu.Maximize=GetMenuItemID(hmenu,4)
' sysmenu.sep1=GetMenuItemID(hmenu,5)
' sysmenu.Close=GetMenuItemID(hmenu,6)
' sysmenu.sep2=GetMenuItemID(hmenu,7)
' sysmenu.KillApps=GetMenuItemID(hmenu,8)
Calldll #user, "DeleteMenu", hmenu As Ulong, sysmenu.Size As Ulong, _
_MF_BYCOMMAND As Ulong, re As Ulong
Calldll #user, "DeleteMenu", hmenu As Ulong, sysmenu.Maximize As Ulong, _
_MF_BYCOMMAND As Ulong, re As Ulong
Close #user
End Sub
Function GetMenuItemID(hmenu,index)
Calldll #user, "GetMenuItemID", hmenu As Ulong, index As Ulong, GetMenuItemID As Ulong
End Function
Sub loadNamesFiltered handle$
'show only the records that match the filter
Call addRecord handle$
Print #main.filter, "selection? filter$"
Open "contact4.dat" For Random As #contacts Len = 800
Field #contacts, 35 As name$, 35 As contact$, 35 As address$, 20 As city$, 2 As state$, _
10 As zip$, 15 As phone$,15 As phone2$,15 As fax$, 15 As cell$, 50 As email$, _
20 As stage$, 500 As memo$, 13 As moddate$, 13 As mailDate$, 7 As extra$
Get #contacts, 1
contactCount = Val(name$)
If contactCount = 0 Then
Close #contacts
Goto [moveOn]
End If
'compare stage to filter
For index = 2 To contactCount + 1
Gettrim #contacts, index
If filter$ = stage$ Or filter$ = "All" Then
name$(index - 1) = str$(index-1)+") "+name$
Else
name$(index - 1) = ""
End If
Next index
Close #contacts
Print #main.contacts, "Reload"
[moveOn]
End Sub
Sub modifyRecord handle$
addName = 0
Print #main.contacts, "Selection? selection$"
If selection$ = "" Then [noName]
Print #main.contacts, "SelectionIndex? index"
If index = 0 Then [noName] 'This should never need to happen
recordIndex=val(selection$)
[getContactRecord]
getIndex=recordIndex+1
Open "contact4.dat" For Random As #contacts Len = 800
Field #contacts, 35 As name$, 35 As contact$, 35 As address$, 20 As city$, 2 As state$, _
10 As zip$, 15 As phone$,15 As phone2$,15 As fax$, 15 As cell$, 50 As email$, _
20 As stage$, 500 As memo$, 13 As moddate$, 13 As mailDate$, 7 As extra$
Gettrim #contacts, getIndex
Close #contacts
Print #main.name, name$
Print #main.contact, contact$
Print #main.addr, address$
Print #main.city, city$
Print #main.state, state$
Print #main.zip, zip$
Print #main.phone, phone$
Print #main.phone2, phone2$
Print #main.fax, fax$
Print #main.cell, cell$
Print #main.email, email$
Print #main.stage, "SelectIndex 20"
For stageIndex = 0 To filterCount-1
If stage$(stageIndex) = stage$ Then
Print #main.stage, "SelectIndex "; stageIndex + 1
End If
Next stageIndex
Print #main.memo, "" ;
Print #main.memo, memo$ ;
Print #main.mailDate, mailDate$
Print #main.modDate, modDate$
oldStage$=stage$
[noName]
End Sub
Sub addRecord handle$
addName = 1
Print #main.contacts, "SelectIndex 0"
Print #main.name, ""
Print #main.contact, ""
Print #main.addr, ""
Print #main.city, ""
Print #main.state, ""
Print #main.zip, ""
Print #main.phone, ""
Print #main.phone2, ""
Print #main.fax, ""
Print #main.cell, ""
Print #main.email, ""
Print #main.stage, "SelectIndex 20"
Print #main.memo, ""
Print #main.name, "!SetFocus"
Print #main.mailDate, "N/A"
Print #main.modDate, "N/A"
End Sub
Sub duplicateControl handle$
dupo=Abs(dupo-1)
If dupo=1 Then
text$="Hide Duplicates"
Calldll #user32, "SetWindowTextA",_
hFind As Ulong,_
text$ As Ptr,_
ret As Void
Call resizeWindow
WindowWidth=150
WindowHeight=75
StaticText #patience, "PLEASE WAIT...", 25, 15, 100, 25
Open "SEARCHING...", For Dialog_Modal As #patience
For i1=1 To contactCount-1
For i2=i1+1 To contactCount
If Lower$(Mid$(name$(i1),Instr(name$(i1),") ")+2,10))=Lower$(Mid$(name$(i2),Instr(name$(i2),") ")+2,10)) Then
dupNum=dupNum+1
dup$(dupNum)=Mid$(name$(i1),Instr(name$(i1),") ")+2)+" @ "+Str$(i1)+" & "+Str$(i2)
End If
Next i2
Next i1
If dupNum=0 Then
dup$(1)="No Duplicates Found"
End If
Print #main.namel, "Reload"
Close #patience
Else
text$="Find Duplicates"
Calldll #user32, "SetWindowTextA",_
hFind As Ulong,_
text$ As Ptr,_
ret As Void
For clearList=1 To dupNum
dup$(clearList)=""
Next clearList
Print #main.namel, "Reload"
dupNum=0
Call resizeWindow
End If
End Sub
Sub acceptEntry handle$
Print #main.name, "!contents? name$";
If name$<>"" Then
Print #main.contact, "!contents? contact$";
Print #main.addr, "!contents? address$";
Print #main.city, "!contents? city$";
Print #main.state, "!contents? state$";
Print #main.zip, "!contents? zip$";
Print #main.phone, "!contents? phone$";
Print #main.fax, "!contents? fax$"
Print #main.cell, "!contents? cell$"
Print #main.email, "!contents? email$"
Print #main.stage, "Selection? stage$";
Print #main.memo, "!Contents? memo$";
If addName = 1 Then
contactCount = contactCount + 1
recordIndex = contactCount
End If
name$(recordIndex) = Str$(recordIndex)+") "+name$
Print #main.contacts, "Reload"
date$=Date$()
If oldStage$="Opening Mailer" And stage$="Follow Up Call" then
mailDate$=Date$()
End If
[saveContactRecord]
Open "contact4.dat" For Random As #contacts Len = 800
Field #contacts, 35 As name$, 35 As contact$, 35 As address$, 20 As city$, 2 As state$, _
10 As zip$, 15 As phone$,15 As phone2$,15 As fax$, 15 As cell$, 50 As email$, _
20 As stage$, 500 As memo$, 13 As moddate$, 13 As mailDate$, 7 As extra$
Put #contacts, recordIndex + 1
Close #contacts
If addName = 0 Then [goBack]
Open "contact4.dat" For Random As #contacts Len = 800
Field #contacts, 35 As count$, 765 As fill$
count$ = Str$(contactCount)
Put #contacts, 1
Close #contacts
addName = 0
Call loadNamesFiltered " "
[goBack]
Print #main.contacts, "SelectIndex ";recordIndex
Call addRecord handle$
Else
Notice "NO BUSINESS NAME"+Chr$(13)+"The business name must be entered, "_
+Chr$(13)+"before a record can be saved. "
End If
End Sub
Sub resizeWindow
If dupo=1 Then
xExtent=695
ULX=int((DisplayWidth-xExtent)/2)
ULY=int((DisplayHeight-460)/2)
Else
xExtent=495
ULX=int((DisplayWidth-xExtent)/2)
ULY=int((DisplayHeight-460)/2)
End If
CallDll #user32, "SetWindowPos",_
hMain As Ulong,_
0 As Long,_
ULX As Long,_
ULY As Long,_
xExtent As Long,_
460 As Long,_
0 As Ulong,_
result As Void
End Sub
sub sortem sortBy
WindowWidth=150
WindowHeight=75
StaticText #patience, "PLEASE WAIT...", 25, 15, 100, 25
Open "SORTING...", For Dialog_Modal As #patience
Call populateList
Sort builder$(), 2, contactCount+1, sortBy
Call saveList
Call loadNames
Call loadNamesFiltered handle$
Close #patience
Notice "SORT FINISHED"+Chr$(13)+"Sorted names reloaded"
End Sub
Sub populateList
Open "contact4.dat" For Random As #contacts3 Len = 800
Field #contacts3, 35 As name$, 35 As contact$, 35 As address$, 20 As city$, 2 As state$, _
10 As zip$, 15 As phone$,15 As phone2$,15 As fax$, 15 As cell$, 50 As email$, _
20 As stage$, 500 As memo$, 13 As moddate$, 13 As mailDate$, 7 As extra$
Open "contact.dat" For Random As #contacts Len = 800
Field #contacts, 35 As name$, 35 As contact$, 35 As address$, 20 As city$, 2 As state$, _
10 As zip$, 15 As phone$,15 As phone2$,15 As fax$, 15 As cell$, 50 As email$, _
20 As stage$, 500 As memo$, 13 As moddate$, 13 As mailDate$, 7 As extra$
Get #contacts3, 1
contactCount = Val(name$)
Put #contacts, 1
For index2 = 2 To contactCount + 1
Gettrim #contacts3, index2
For column=1 To 13
Select Case column
Case 1
builder$(index2, column)=name$
Case 2
builder$(index2, column)=contact$
Case 3
builder$(index2, column)=address$
Case 4
builder$(index2, column)=city$
Case 5
builder$(index2, column)=state$
Case 6
builder$(index2, column)=zip$
Case 7
builder$(index2, column)=phone$
Case 8
builder$(index2, column)=fax$
Case 9
builder$(index2, column)=cell$
Case 10
builder$(index2, column)=email$
Case 11
builder$(index2, column)=stage$
Case 12
builder$(index2, column)=memo$
Case 13
builder$(index2, column)=date$
End Select
Next column
Next index2
End Sub
Sub saveList
For index2 = 2 To contactCount + 1
For column=1 To 13
Select Case column
Case 1
name$=builder$(index2, column)
Case 2
contact$=builder$(index2, column)
Case 3
address$=builder$(index2, column)
Case 4
city$=builder$(index2, column)
Case 5
state$=builder$(index2, column)
Case 6
zip$=builder$(index2, column)
Case 7
phone$=builder$(index2, column)
Case 8
fax$=builder$(index2, column)
Case 9
cell$=builder$(index2, column)
Case 10
email$=builder$(index2, column)
Case 11
stage$=builder$(index2, column)
Case 12
memo$=builder$(index2, column)
Case 13
date$=builder$(index2, column)
End Select
Next column
Put #contacts, index2
Next index2
Close #contacts3
Close #contacts
If exists("contact4recoverold.bak") Then
Kill "contact4recoverold.bak"
End If
If exists("contact4recover.bak") Then
Name "contact4recover.bak" As "contact4recoverold.bak"
End If
Name "contact4.dat" As "contact4recover.bak"
Name "contact.dat" As "contact4.dat"
End Sub
Function exists(a$)
Files DefaultDir$, a$, existInfo$()
exists=val(existInfo$(0,0))
End Function
Sub removeEntry
Print #main.filter, "selection? filter$"
If addName=0 Then
Confirm "YOU ARE ABOUT TO DELETE THIS RECORD"+Chr$(13)+" "+Chr$(13)+Chr$(34)_
+name$(recordIndex)+Chr$(34)+Chr$(13)+" "+Chr$(13)+"Do you want to proceed?";delAns$
If Lower$(delAns$)="no" Then [noDelete]
WindowWidth=150
WindowHeight=75
StaticText #patience, "PLEASE WAIT...", 10, 15, 100, 25
Open "DELETING...", For Dialog_Modal As #patience
Open "contact4.dat" For Random As #contacts Len = 800
Field #contacts, 35 As name$, 35 As contact$, 35 As address$, 20 As city$, 2 As state$, _
10 As zip$, 15 As phone$,15 As phone2$,15 As fax$, 15 As cell$, 50 As email$, _
20 As stage$, 500 As memo$, 13 As moddate$, 13 As mailDate$, 7 As extra$
For moveRecords=recordIndex+1 To contactCount
Get #contacts, moveRecords+1
Put #contacts, moveRecords
Next moveRecords
Get #contacts, 1
name$(Val(name$))=""
name$=Str$(Val(name$)-1)
Put #contacts, 1
Close #contacts
Close #patience
Call loadNames
Call loadNamesFiltered handle$
Notice "RECORD DELETED"+Chr$(13)+"Names reloaded"
Else
Notice "NO RECORD SELECTED!"+Chr$(13)+"Please select a record," _
+Chr$(13)+"then select delete from the menu."
End If
[noDelete]
End Sub
Sub pick handle$
Print #main.namel, "Selection? duplicate$"
locateRecord=Instr(duplicate$," @ ")
recordNum=Val(Mid$(duplicate$,locateRecord+3))
Print #main.contacts, "SelectIndex ";recordNum
Print #main.contacts, "SelectIndex 0"
End Sub
Sub refilter
Stylebits #filterer, 0, _WS_VISIBLE, 0, 0
Stylebits #filterer.S1, _ES_READONLY Or _WS_DISABLED, 0, 0, 0
Stylebits #filterer.S2, _ES_READONLY Or _WS_DISABLED, 0, 0, 0
Stylebits #filterer.S3, _ES_READONLY Or _WS_DISABLED, 0, 0, 0
WindowWidth = 305
WindowHeight = 400
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
Statictext #filterer, "stage 1", 10, 10, 70, 20
Textbox #filterer.S1, 90, 10, 200, 20
Statictext #filterer, "stage 2", 10, 35, 70, 20
Textbox #filterer.S2, 90, 35, 200, 20
Statictext #filterer, "stage 3", 10, 60, 70, 20
Textbox #filterer.S3, 90, 60, 200, 20
Statictext #filterer, "stage 4", 10, 85, 70, 20
Textbox #filterer.S4, 90, 85, 200, 20
Statictext #filterer, "stage 5", 10, 110, 70, 20
Textbox #filterer.S5, 90, 110, 200, 20
Statictext #filterer, "stage 6", 10, 135, 70, 20
Textbox #filterer.S6, 90, 135, 200, 20
Statictext #filterer, "stage 7", 10, 160, 70, 20
Textbox #filterer.S7, 90, 160, 200, 20
Statictext #filterer, "stage 8", 10, 185, 70, 20
Textbox #filterer.S8, 90, 185, 200, 20
Statictext #filterer, "stage 9", 10, 210, 70, 20
Textbox #filterer.S9, 90, 210, 200, 20
Statictext #filterer, "stage 10", 10, 235, 70, 20
Textbox #filterer.S10, 90, 235, 200, 20
Statictext #filterer, "stage 11", 10, 260, 70, 20
Textbox #filterer.S11, 90, 260, 200, 20
Statictext #filterer, "stage 12", 10, 285, 70, 20
Textbox #filterer.S12, 90, 285, 200, 20
Statictext #filterer, "stage 13", 10, 310, 70, 20
Textbox #filterer.S13, 90, 310, 200, 20
Statictext #filterer, "stage 14", 10, 335, 70, 20
Textbox #filterer.S14, 90, 335, 200, 20
Statictext #filterer, "stage 15", 10, 360, 70, 20
Textbox #filterer.S15, 90, 360, 200, 20
Button #filterer.OK, "Save", [newFilter], UL, 85, 390
Button #filterer.close, "Close", [unFilter], UL, 165, 390
Open "Edit Stage List" For dialog_modal As #filterer
Print #filterer, "font fixedsys 9"
Print #filterer, "trapclose [unFilter]"
fHwnd=Hwnd(#filterer)
Open "filter.lst" For Input As #filter
Input #filter, filterCount
For filterIndex=1 to filterCount
Input #filter, filterName$
handle$="#filterer.S"+Str$(filterIndex)
Print #handle$, filterName$
Next filterIndex
Close #filter
Calldll #user32, "MoveWindow",_
fHwnd As ULong,_
UpperLeftX As Long,_
UpperLeftY As Long,_
305 As Long,_
450 As Long,_
1 As Long,_
success As Long
Calldll #user32, "ShowWindow",_
fHwnd As Long,_
1 As Long,_
success As Long
Wait
[newFilter]
Open "filter.lst" For Output As #filter
For filterIndex=1 To 15
handle$="#filterer.S"+Str$(filterIndex)
Print #handle$, "!contents? filterName$"
If filterName$="" Then
filterCount=filterIndex-1
Exit For
Else
filterCount=filterIndex
End If
Next filterIndex
Print #filter, filterCount
For filterIndex=1 to 15
If filterIndex<=filterCount Then
handle$="#filterer.S"+Str$(filterIndex)
Print #handle$, "!contents? filterName$"
Print #filter, filterName$
stage$(filterIndex-1)=filterName$
Else
stage$(filterIndex-1)=""
End If
Next filterIndex
Close #filter
print #main.stage, "reload"
Print #main.filter, "reload"
Wait
[unFilter]
Close #filterer
End Sub
Sub coderInfo
Stylebits #about, 0, _WS_VISIBLE, 0, 0
WindowWidth = 335
WindowHeight = 345
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
Statictext #about, " CONTACT MANAGER v4.25", 10, 10, 300, 20
Statictext #about, " a production of", 10, 35, 300, 20
Statictext #about, " EagleWings Software", 10, 55, 300, 20
Statictext #about, " and Liberty BASIC", 10, 75, 300, 20
Statictext #about, " copyright 4/26/2004", 10, 95, 300, 20
Statictext #about, "This code is released as open source.", 10, 120, 300, 20
Statictext #about, " Use of this program signifies your", 10, 145, 300, 20
Statictext #about, "acceptance of the following provision.", 10, 165, 305, 20
Statictext #about, "You accept full responsibility for any", 10, 190, 305, 20
Statictext #about, " problems arising from the use, abuse,", 10, 210, 305, 20
Statictext #about, " or modification of this program", 10, 230, 300, 20
Button #about.close, "OK", [aboutFace], UL, 145, 260
Open "All about Contact Manager" For dialog_modal As #about
Print #about, "font fixedsys 9"
Print #about, "trapclose [aboutFace]"
aHwnd=Hwnd(#about)
Calldll #user32, "MoveWindow",_
aHwnd As ULong,_
UpperLeftX As Long,_
UpperLeftY As Long,_
335 As Long,_
345 As Long,_
1 As Long,_
success As Long
Calldll #user32, "ShowWindow",_
aHwnd As Long,_
1 As Long,_
success As Long
Wait
[aboutFace]
Close #about
End Sub
Sub versionInfo
Stylebits #version, 0, _WS_VISIBLE, 0, 0
WindowWidth = 350
WindowHeight = 475
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
Statictext #version, "This program started as a demo program included with Liberty BASIC", 10, 10, 325, 15
Statictext #version, " version 3.0 written by Carl Gundel, author of Liberty BASIC", 10, 25, 325, 15
Statictext #version, " version 4.xx modifications by Ken Lewis, Sr.", 10, 45, 325, 15
Statictext #version, " (EagleWings Software)", 10, 60, 325, 15
Statictext #version, " copyright 4/26/2004", 10, 75, 325, 15
Statictext #version, "version 4.00", 10, 95, 325, 15
Statictext #version, " moved all code possible to subs and functions", 10, 110, 325, 15
Statictext #version, " modified code to take advantage of LB 4 features", 10, 125, 325, 15
Statictext #version, "version 4.01", 10, 145, 325, 15
Statictext #version, " fixed bugs in retreiving record when filter was other than 'all'", 10, 160, 325, 15
Statictext #version, "version 4.10", 10, 180, 325, 15
Statictext #version, " added sort records by business name or city", 10, 195, 325, 15
Statictext #version, "version 4.20", 10, 215, 325, 15
Statictext #version, " added delete record only if filter was set to 'all'", 10, 230, 325, 15
Statictext #version, "version 4.21", 10, 250, 325, 15
Statictext #version, " fixed bug in find duplicates", 10, 265, 325, 15
Statictext #version, "'version 4.22", 10, 285, 325, 15
Statictext #version, " added record numbers to listbox array", 10, 300, 325, 15
Statictext #version, " thereby allowing delete record when filter was other than 'all'", 10, 315, 325, 15
Statictext #version, "version 4.23", 10, 335, 325, 15
Statictext #version, " added 'please wait' screens when program was busy processing", 10, 350, 325, 15
Statictext #version, "version 4.24", 10, 370, 325, 15
Statictext #version, " added help menu and associated code", 10, 385, 325, 15
Statictext #version, "version 4.25", 10, 400, 325, 15
Statictext #version, " repaired stage list edit and phone # length", 10, 415, 325, 15
Button #version.close, "OK", [aVersion], UL, 160, 440
Open "Contact Manager version history" For dialog_modal As #version
Print #version, "font ariel 8"
Print #version, "trapclose [aVersion]"
vHwnd=Hwnd(#version)
Calldll #user32, "MoveWindow",_
vHwnd As ULong,_
UpperLeftX As Long,_
UpperLeftY As Long,_
350 As Long,_
510 As Long,_
1 As Long,_
success As Long
Calldll #user32, "ShowWindow",_
vHwnd As Long,_
1 As Long,_
success As Long
Wait
[aVersion]
Close #version
End Sub
Sub helpInfo
CrLf$=Chr$(13)+Chr$(10)
ListboxColor$="PaleGray"
TextboxColor$="PaleGray"
Restore [helpContents]
For contents=1 To 13
Read contents$
hContents$(contents)=contents$
Next contents
StyleBits #help, 0, _WS_VISIBLE, 0, 0
Stylebits #help.explain, _WS_VSCROLL Or _ES_READONLY Or _ES_MULTILINE , _ES_AUTOHSCROLL, 0, 0 '
WindowWidth = 600
WindowHeight = 325
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
StaticText #help, "Left click on a help topic", 10, 10, 150, 20
TextBox #help.explain, 170, 10, 415, 270
ListBox #help.contents, hContents$(, [getHelp], 10, 30, 145, 220
Button #help.close, " Exit Help ", [helpless], UL, 30, 256
Open "Contact Manager Help" For dialog_modal As #help
Print #help, "font ariel 10"
Print #help, "trapclose [helpless]"
Print #help.contents, "SingleClickSelect"
hHwnd=Hwnd(#help)
hcHwnd=Hwnd(#help.contents)
Calldll#user32, "ShowScrollBar",_
hcHwnd As ULong,_
_SB_VERT As Long,_
0 As Boolean,_
success As Boolean
Calldll #user32, "MoveWindow",_
hHwnd As ULong,_
UpperLeftX As Long,_
UpperLeftY As Long,_
600 As Long,_
325 As Long,_
1 As Long,_
success As Long
calldll #user32, "ShowWindow",_
hHwnd As Long,_
1 As Long,_
success As Long
Restore [02]
Read ItemCount
For count=1 to ItemCount
Read explainIt$
If explainIt$="CrLf" then
showIt$=showIt$+CrLf$
else
showIt$=showIt$+explainIt$
End If
Next count
Print #help.explain, showIt$
Wait
[getHelp]
showIt$=""
Print #help.contents, "SelectionIndex? explainIndex"
Select Case explainIndex
Case 1
Restore [01]
Case 2
Restore [02]
Case 3
Restore [03]
Case 4
Restore [04]
Case 5
Restore [05]
Case 6
Restore [06]
Case 7
Restore [07]
Case 8
Restore [08]
Case 9
Restore [09]
Case 10
Restore [10]
Case 11
Restore [11]
Case 12
Restore [12]
End Select
Read ItemCount
For count=1 to ItemCount
Read explainIt$
If explainIt$="CrLf" then
showIt$=showIt$+CrLf$
else
showIt$=showIt$+explainIt$
End If
Next count
Print #help.explain, showIt$
Wait
[helpContents]
Data "What is Libby?", "Contact Manager?", "Adding Records", "Selecting Records"
Data "Setting the Stage", "Editing the Stage List", "Modifying Records"
Data "Filtering Records", "Saving Records", "Sorting Records", "Finding Duplicates"
Data "Deleting Records", "Backup Information"
[01]
Data 35, "CrLf", "WHAT IS LIBBY?", "CrLf", "CrLf", " Libby is a suite of open "
Data "source software, contributed by the Liberty BASIC community.", " The intent, "
Data "of this open source project, is to increase the public's awareness of Liberty "
Data "BASIC's true capabilities.", " It is toward this end, that I have offered "
Data "this program for placement, in the Libby open source project.", "CrLf", "CrLf"
Data "Kenneth J. Lewis, Sr.", "CrLf", "(EagleWings Software)"
Data "CrLf", "CrLf", "WHY CONTACT MANAGER?", "CrLf", "CrLf", " Contact Manager began as "
Data "a personal project.", " My intention, was to create a program that would aid "
Data "in managing and tracking contacts, for my business.", "CrLf", "CrLf", " I "
Data "started with 'contact3.bas', an example program that is included with Liberty BASIC."
Data " I rewrote the original code to take advantage of the features of 'Liberty BASIC "
Data "v4.xx'.", " I added and improved many features.", " Contact Manager grew into a "
Data "fairly nice program, so I decided I would offer it to the Libby project.", "CrLf"
[02]
Data 26, "CrLf", "WHAT IS CONTACT MANAGER?", "CrLf", "CrLf", " Contact Manager is "
Data "currently a medium featured program.", " It is designed to track business "
Data "contacts, and their current relationship to your company", "CrLf", "CrLf",
Data " It's current features include", "CrLf", "CrLf",
Data " ** New records are easy to add.", "CrLf", " ** Records can be filtered by "
Data "their current stage.", "CrLf", " ** Sort records by business name or by city."
Data "CrLf", " ** Records can be deleted on the fly.","CrLf", " **Select and "
Data "modify records easily.", "CrLf", " ** Edit the list of stages.", "CrLf"
[03]
Data 11, "CrLf", "ADDING RECORDS", "CrLf", "CrLf", " To add a new record, left click "
Data "the 'New Record' button in the lower left corner of the window.", " Or select 'new' "
Data "from the 'Records' menu.", " Fill out the desired information on the contact form."
Data " Then left click the 'Save Record' button in the lower right corner of the window."
Data " Or select 'save' from the 'Records' menu.",
[04]
Data 15, "CrLf", "SELECTING RECORDS", "CrLf", "CrLf", " To select a record to view in "
Data "the contact form, left click on the name of a business.", " This will fill the "
Data "form with the contacts information.", " The 'Date Last Modified' and 'Mailing "
Data "Date' fields can not be edited by the user.", " These are filled in automatically, "
Data "by the program.", " In order for the 'Mailing Date' to be accurate, the stage must "
Data "reflect the next stage that is to be completed, not the stage that has just been "
Data "completed."
[05]
Data 12, "CrLf", "SETTING THE STAGE", "CrLf", "CrLf", " To set a contact's stage, "
Data "select the stage, from the 'Stage' combobox, in the contact form.", " A word of "
Data "caution!", " The stage must be set to the next stage that is to be completed, "
Data "not the stage that has just been completed.", " Otherwise the 'Mailing Date' "
Data "will not accurately reflect the date, a mailing took place."
[06]
Data 19, "CrLf", "EDITING THE STAGE LIST", "CrLf", "CrLf", " To edit the list of "
Data "stages, from the 'Edit' menu select 'stage list'.", " This brings up the 'Stage "
Data "List' edit window.", " The current stage list will be displayed in the textboxes, "
Data "that correspond to the stage number.", " Stage 1, Stage 2 and Stage 3 "
Data "cannot be modified.", " The other stages can be changed by highlighting the old "
Data "stage name, and typing in a new stage name.", "CrLf", "CrLf", " I hope that "
Data "adding the ability to edit the stage list, will make this program appeal to a wider "
Data "group of users."
[07]
Data 19, "CrLf", "MODIFYING RECORDS", "CrLf", "CrLf", " To modify a record, left "
Data "click a record in the contact list.", " Change the necessary information in the "
Data "contact form.", " Then left click the 'Save Record' button in the lower right "
Data "corner of the window.", " Or select 'save' from the 'Records' menu.", "CrLf"
Data "CrLf", " The 'Date Last Modified' and 'Mailing Date' fields can not be edited "
Data "by the user.", " These are filled in automatically, by the program.", " In "
Data "order for the 'Mailing Date' to be accurate, the stage must reflect the next stage "
Data "that is to be completed, not the stage that has just been completed."
[08]
Data 8, "CrLf", "FILTERING RECORDS", "CrLf", "CrLf", " Records can be filtered, for "
Data "the contact list, by selecting a stage from the 'Filter Contacts' combobox."
Data " This will filter the contacts by the stage selected, and display only those "
Data "contacts, whose stage matches the filter."
[09]
Data 8, "CrLf", "SAVING RECORDS", "CrLf", "CrLf", " To save a new or modified "
Data "record, left click on the 'Save Record' button in the lower right corner of the "
Data "window.", " Or select 'save' from the 'Records' menu."
[10]
Data 22, "CrLf", "SORTING RECORDS", "CrLf", "CrLf", " Records can be sorted by "
Data "business name, or by the city listed in their address.", " Select 'sort' from "
Data "the 'Records' menu.", " You will be presented with a popup menu.", " Select "
Data "either 'name sort', or 'city sort'.", "CrLf", "CrLf", " 'name sort' ", "CrLf"
Data " Sorts your contacts, alphabetically by business name.", "CrLf", "CrLf"
Data " 'city sort' ", "CrLf", " Groups your contacts by city, with the city "
Data "sorted alphabetically.",
[11]
Data 26, "CrLf", "FINDING DUPLICATES", "CrLf", "CrLf", " To find duplicate records, "
Data "left click on the 'Find Duplicates' button at the bottom center of the window."
Data " This will add a duplicates listbox to the right side of the window.", " It is "
Data "recomended that you sort the contact list, by business name, first.", " This will "
Data "place any duplicate records next to each other.", " Making the duplicate easier "
Data "to locate.", "CrLf", "CrLf", " When the list is populated, left click on a "
Data "contact in the duplicates list.", " The corresponding entry will then be brought "
Data "into view near the bottom of the contacts list.", " At this point you can left "
Data "click on each record to view the records one at a time, and decide which one to "
Data "keep.", " Left click on the record that is to be eliminated, and either replace "
Data "the information in the contacts form with a new record, or delete the record."
Data " (see 'DELETING RECORDS' in the 'help' section of the 'Help' menu).", "CrLf"
[12]
Data 13, "CrLf", "DELETING RECORDS", "CrLf", "CrLf", " Records can be deleted by "
Data "first, selecting a record from the contact list.", " This displays the contact's "
Data "information in the contact form.", " After reviewing the record, select 'delete' "
Data "from the 'Records' menu.", " You will be prompted to confirm the record deletion."
Data " Left click the 'yes' button to delete the record, or left click the 'no' button, "
Data "to keep the record."
[13]
Data 44, "CrLf", "BACKUP INFORMATION", "CrLf", "CrLf", " This program uses a double "
Data "backup system.", " Whenever one of the following actions occurs, the data file "
Data "is backed up as 'contact4.bak'.", " If 'contact4.bak' already exists, it is renamed "
Data "as 'contact4old.bak'.", " This way the last two backups are always available."
Data "CrLf", "CrLf", " The actions that trigger a backup are...", "CrLf"
Data " **Starting the program", "CrLf", " **Saving a new record", "CrLf"
Data " **Saving a modified record", "CrLf"," **Deleting a record", "CrLf", "CrLf"
Data " In addition Whenever you sort the records, the data file is backed up as "
Data "'contact4recover.bak'.", " If 'contact4recover.bak' already exists, it is renamed "
Data "as 'contact4recoverold.bak'.", " This provides two additional backup files to "
Data "recover records from, in the event of a system crash.", " Any one of these files "
Data "can be renamed as 'contact4.dat' to recover data from them.", " Of course if "
Data "'contact4.dat' still exists, it will have to be renamed first.", " I suggest "
Data "something like contact4.old.", "CrLf", "CrLf", " Normal usage of the program "
Data "will usually cause 'contact4.bak' and 'contact4old.bak' to be the most recent "
Data "backups.", " However if you have just sorted the records, then "
Data "'contact4recover.bak' and 'contact4recoverold.bak' will be the most recent.", "CrLf"
[helpless]
Close #help
End Sub