home *** CD-ROM | disk | FTP | other *** search
- *************
- * Deck "NewPhone"
- *************
-
- *************
- * Card(s) in deck.
- * Card "Card#1"
- *************
- * 1 Card(s), 1 were printed.
- *************
-
- *************
- * Natural order of Cards
- * Card "Card#1"
- *************
-
- *************
- * There are no Global routines in this deck.
- *************
-
- *************
- * Card "Card#1"
- BeforeAttachment
- LoadSubDeck "SubDecks/PhoneSearch","PhoneSearch"
- LoadSubDeck "SubDecks/SimpleReq","SimpleReq"
- SetBusyPointer "CanDo:Brushes/Cover.Pntr"
- EndScript
- AfterAttachment
- FastFeedBack On
- Let FieldNames[1] = ".Name"
- Let FieldNames[2] = ".Address"
- Let FieldNames[3] = ".Phone"
- Let FieldNames[4] = ".Comments"
- SetPen 2
- DrawRectangle 8,13,622,58
- SetPen 1
- DrawRectangle 7,12,622,58
- SetPen 2
- DrawRectangle 8,74,622,123
- SetPen 1
- DrawRectangle 7,73,622,123
- PrintText "Name",42,79
- PrintText "Address",19,96
- PrintText "Phone",412,96
- PrintText "Comments",11,149
- Let DataModified = False
- Let DataFile = "NewPhone.DAT"
- If Exists(DataFile)
- Do "Load DataFile" ;does a stop script on an error
- Else
- Let PhoneData[1] = GetDBObjects ;debug
- EndIf
- Do "Get Entry",1
- Do "Set Field",1
- EndScript
- MessageFromSubDeck
- If Arg1 <> ""
- Do Arg1,Alias("Arg2"),Alias("Arg3"),Alias("Arg4")
- EndIf
- EndScript
- Routine "Quit"
- If Arg1
- SaveVariable PhoneData,DataFile
- EndIf
- Quit
- EndScript
- Routine "Set Field"
- If Arg1 = Nothing
- Let CurrField = CurrField + 1
- Else
- Let CurrField = Arg1
- EndIf
- If CurrField > LastArrayIndex(FieldNames)
- Let CurrField = 1
- EndIf
- SetObjectState FieldNames[CurrField],ON
- EndScript
- Routine "Search Next"
- Local NewEntry
- SetSearchArrayFlags NOCASE FORWARD SUBSTRING
- Let NewEntry = SearchArray(PhoneData,SearchText,"." || SearchField,Entry+1)
- If Not SearchFound
- Let NewEntry = SearchArray(PhoneData,SearchText,"." || SearchField)
- EndIf
- If SearchFound
- Do "Goto Entry",NewEntry
- EndIf
- EndScript
- Routine "Do Search"
- If Arg1
- Let SearchText = Arg2
- Let SearchField = Arg3
- Do "Search Next"
- EndIf
- Do "Set Field",1
- EndScript
- Routine "Delete Entry"
- DeleteArrayEntry PhoneData,Arg1
- PositionOnLine Arg1
- If TheLineNumber = LinesInDocument
- Clear LINE
- Delete CHARACTER ,-1
- Else
- Delete LINE
- EndIf
- EndScript
- Routine "Load Error"
- OpenRequester "SimpleReq","Comment","","Error while loading " || DataFile,ErrorText
- Let PhoneData[1] = GetDBObjects ;debug
- Do "Get Entry",1
- StopScript
- EndScript
- Routine "Load DataFile"
- DoOnError "Load Error"
- Let PhoneData = LoadVariable(DataFile)
- WorkWithDocument "Name List"
- Clear DOCUMENT
- Let Entry = FirstArrayIndex(PhoneData)
- While SearchFound
- Type PhoneData[Entry].Name,NEWLINE
- Let Entry = NextArrayIndex(PhoneData,Entry)
- EndLoop
- Delete CHARACTER ,-1
- MoveCursorTo STARTOF DOCUMENT
- Let Entry = 1
- EndScript
- Routine "Put Name In List"
- Local TempName
- Let TempName = UpperCase(Arg1)
- MoveCursorTo STARTOF DOCUMENT
- If SizeOfDocument <> 0
- Loop
- If UpperCase(TheLine) < TempName
- If TheLineNumber = LinesInDocument
- NewLine
- ExitLoop
- EndIf
- MoveCursor DOWN
- Else
- SplitLine
- MoveCursor UP
- ExitLoop
- EndIf
- EndLoop
- EndIf
- Type Arg1
- EndScript
- Routine "Store Entry"
- WorkWithDocument "Name List"
- Let Work = GetDBObjects
- If Work <> PhoneData[Entry]
- If Work.Name <> PhoneData[Entry].Name
- Do "Delete Entry",Entry
- Do "Put Name In List",Work.Name
- Let Entry = TheLineNumber
- InsertArrayEntry PhoneData,Entry
- EndIf
- Let PhoneData[Entry] = Work
- Let DataModified = True
- EndIf
- EndScript
- Routine "Get Entry"
- Let Entry = Arg1
- SetDBObjects PhoneData[Entry]
- WorkWithDocument "Name List"
- PositionOnLine Arg1
- EndScript
- Routine "Goto Entry"
- If Arg1 <> Entry
- Do "Store Entry"
- Do "Get Entry",Arg1
- EndIf
- EndScript
- Window "UserWindow"
- Definition
- Origin 0,0
- Size 640,200
- Title "Phone List"
- NumberOfColors 4
- DefaultColors 0,1,0
- WindowObjects CLOSEBUTTON DEPTHBUTTONS DRAGBAR
- WindowFlags ACTIVATE TOFRONT ; WORKBENCH
- VisualEffects NONE ,WAIT
- EndScript
- OnCloseButton
- Do "Store Entry"
- If DataModified
- OpenRequester "SimpleReq","YesNo","Quit","Phone Data has been modified.","Save it before leaving?"
- Else
- Do "Quit",False
- EndIf
- EndScript
- EndObject
- AKey "Ctrl Return Key"
- Definition
- QualifiersPressed CONTROL
- KeyPressed RETURN
- EndScript
- OnDown
- Do "Set Field"
- EndScript
- EndObject
- List "Name List"
- Definition
- Origin 81,18
- Size 324,48
- Font "topaz",8 ; FontName, PointSize
- Style PLAIN
- TextColors 1,2 ; PenA, PenB, DrawMode
- Border DOUBLEBEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen
- ListDocument "Name List" ; where the text comes from
- EndScript
- OnClick
- Do "Goto Entry",TheLineNumber
- EndScript
- OnDrag
- Do "Goto Entry",TheLineNumber
- EndScript
- OnRelease
- Do "Set Field",1
- EndScript
- EndObject
- TextButton "Search Button"
- Definition
- Origin 420,26
- Font "topaz",8 ; FontName, PointSize
- Style PLAIN ,2,3
- TextColors 1,0,JAM1 ; PenA, PenB, DrawMode
- Text " Search... "
- Border BEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen
- Highlight COMPLEMENT
- ButtonFlags NONE
- EndScript
- OnRelease
- OpenWindow "PhoneSearch","SearchCard","Do Search",SearchText,SearchField
- EndScript
- EndObject
- TextButton "Search Next Button"
- Definition
- Origin 420,46
- Font "topaz",8 ; FontName, PointSize
- Style PLAIN ,2,3
- TextColors 1,0,JAM1 ; PenA, PenB, DrawMode
- Text " Search Next "
- Border BEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen
- Highlight COMPLEMENT
- ButtonFlags NONE
- EndScript
- OnRelease
- Do "Search Next"
- Do "Set Field",1
- EndScript
- EndObject
- TextButton "Add Button"
- Definition
- Origin 535,26
- Font "topaz",8 ; FontName, PointSize
- Style PLAIN ,2,3
- TextColors 1,0,JAM1 ; PenA, PenB, DrawMode
- Text " Add "
- Border BEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen
- Highlight COMPLEMENT
- ButtonFlags NONE
- EndScript
- OnRelease
- Do "Store Entry"
- SetDBObjects Nothing
- If SizeOfDocument <> 0
- WorkWithDocument "Name List"
- MoveCursorTo STARTOF DOCUMENT
- SplitLine
- MoveCursor UP
- Let Entry = 1
- InsertArrayEntry PhoneData,Entry
- EndIf
- Let PhoneData[Entry] = GetDBObjects ;debug
- Let DataModified = True
- Do "Set Field",1
- EndScript
- EndObject
- TextButton "Delete Button"
- Definition
- Origin 535,46
- Font "topaz",8 ; FontName, PointSize
- Style PLAIN ,2,3
- TextColors 1,0,JAM1 ; PenA, PenB, DrawMode
- Text " Delete "
- Border BEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen
- Highlight COMPLEMENT
- ButtonFlags NONE
- EndScript
- OnRelease
- WorkWithDocument "Name List"
- Do "Delete Entry",TheLineNumber
- Do "Get Entry",TheLineNumber
- Let PhoneData[Entry] = GetDBObjects ;debug
- Do "Set Field",1
- EndScript
- EndObject
- TextField ".Name"
- Definition
- Origin 82,79
- Size 321,8
- Justification LEFT
- MaxFieldLength 255
- InitialText Nothing
- Border DOUBLEBEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen
- EndScript
- OnClick
- Let CurrField = 1
- EndScript
- OnRelease
- Do "Store Entry"
- Do "Set Field"
- EndScript
- EndObject
- Memo ".Address"
- Definition
- Origin 83,95
- Size 319,44
- Font "topaz",8 ; FontName, PointSize
- Style PLAIN
- TextColors 1,0 ; PenA, PenB, DrawMode
- Border DOUBLEBEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen
- MemoDocument "Address Doc" ; where the text comes from
- ScrollBars RIGHT
- InputStyle NORMAL
- EndScript
- OnClick
- Let CurrField = 2
- EndScript
- OnRelease
- Nop
- EndScript
- EndObject
- Memo ".Phone"
- Definition
- Origin 458,95
- Size 160,44
- Font "topaz",8 ; FontName, PointSize
- Style PLAIN
- TextColors 1,0 ; PenA, PenB, DrawMode
- Border DOUBLEBEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen
- MemoDocument "Phone Doc" ; where the text comes from
- ScrollBars RIGHT
- InputStyle NORMAL
- EndScript
- OnClick
- Let CurrField = 3
- EndScript
- OnRelease
- Nop
- EndScript
- EndObject
- Memo ".Comments"
- Definition
- Origin 83,148
- Size 534,44
- Font "topaz",8 ; FontName, PointSize
- Style PLAIN
- TextColors 1,0 ; PenA, PenB, DrawMode
- Border DOUBLEBEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen
- MemoDocument "Comments Doc" ; where the text comes from
- ScrollBars RIGHT
- InputStyle NORMAL
- EndScript
- OnClick
- Let CurrField = 4
- EndScript
- OnRelease
- Nop
- EndScript
- EndObject
- * End of Card "Card#1"
- *************
-
-