Listing 9. Interface Information and Event Routines for DataEntry Card in CanDo 2.0 1 ************* 2 * Deck "CanDo-Part2-Program2" 3 * Time 18:48:16 4 * Date 06/27/93 5 ************* 6 7 ************* 8 * Card(s) in deck. 9 * Card "DataEntry" 10 ************* 11 * 1 Card(s), 1 were printed. 12 ************* 13 14 ************* 15 * Natural order of Cards 16 * Card "DataEntry" 17 ************* 18 19 ************* 20 * Global Routine(s) in deck. 21 * Routine "Show Record" (was not printed) 22 ************* 23 * 1 Global routines(s), 0 were printed. 24 ************* 25 26 ************* 27 * Card "DataEntry" 28 AfterAttachment ; used to be AfterStartup 29 SetPrintFont "ruby",12 30 SetPrintStyle BOLD SHADOW ,2,3 31 SetPen 1,0 32 SetDrawMode JAM1 33 PrintText " Name:",119,39 34 PrintText "Address:",124,59 35 PrintText " City:",124,79 36 PrintText " State:",119,99 37 PrintText " Zip:",130,119 38 EndScript 39 Window "UserWindow" 40 Definition 41 Origin 0,0 42 Size 640,200 43 Title "Database Demo" 44 NumberOfColors 4 45 WindowColors 0,1,0 ; Detail, Block, Background 46 WindowObjects CLOSEBUTTON 47 WindowFlags ACTIVATE SEPARATESCREEN TOFRONT 48 EndScript 49 OnCloseButton 50 Quit 51 EndScript 52 EndObject 53 TextField ".Name" 54 Definition 55 Origin 214,40 56 Size 221,8 57 Justification LEFT 58 MaxFieldLength 32 59 InitialText "" 60 Border DOUBLEBEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen 61 EndScript 62 OnRelease 63 SetObjectState ".Address",ON 64 EndScript 65 EndObject 66 TextField ".Address" 67 Definition 68 Origin 214,60 69 Size 221,8 70 Justification LEFT 71 MaxFieldLength 32 72 InitialText "" 73 Border DOUBLEBEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen 74 EndScript 75 OnRelease 76 SetObjectState ".City",ON 77 EndScript 78 EndObject 79 TextField ".City" 80 Definition 81 Origin 214,80 82 Size 221,8 83 Justification LEFT 84 MaxFieldLength 32 85 InitialText "" 86 Border DOUBLEBEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen 87 EndScript 88 OnRelease 89 SetObjectState ".State",ON 90 EndScript 91 EndObject 92 TextField ".State" 93 Definition 94 Origin 214,100 95 Size 221,8 96 Justification LEFT 97 MaxFieldLength 32 98 InitialText "" 99 Border DOUBLEBEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen 100 EndScript 101 OnRelease 102 SetObjectState ".ZipCode",ON 103 EndScript 104 EndObject 105 TextField ".ZipCode" 106 Definition 107 Origin 214,120 108 Size 221,8 109 Justification LEFT 110 MaxFieldLength 32 111 InitialText "" 112 Border DOUBLEBEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen 113 EndScript 114 OnRelease 115 SetObjectState ".Name",ON 116 EndScript 117 EndObject 118 TextButton "Add" 119 Definition 120 Origin 107,155 121 Font "System",8 ; FontName, PointSize 122 PrintStyle SHADOW ,2,3 ; Style, Pen1, Pen2 123 TextColors 1,0,NORMAL ; PenA, PenB, DrawMode 124 Text " Add " 125 Border BEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen 126 Highlight COMPLEMENT 127 ButtonFlags NONE 128 EndScript 129 OnRelease 130 Let Address[CurIndex]=GetDBObjects ;store current entry 131 Let CurIndex=CurIndex+1 ;get next index number 132 InsertArrayEntry Address,CurIndex ;insert new index in array 133 Do "Show Record" ;show a blank record 134 EndScript 135 EndObject 136 TextButton "Delete" 137 Definition 138 Origin 177,155 139 Font "System",8 ; FontName, PointSize 140 PrintStyle SHADOW ,2,3 ; Style, Pen1, Pen2 141 TextColors 1,0,NORMAL ; PenA, PenB, DrawMode 142 Text " Del " 143 Border BEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen 144 Highlight COMPLEMENT 145 ButtonFlags NONE 146 EndScript 147 OnRelease 148 DeleteArrayEntry Address,CurIndex ;delete record 149 If VarType(Address[CurIndex])="Nothing" ;see if last 150 Let CurIndex=LastArrayIndex(Address) ;find new last 151 EndIf 152 Do "Show Record" 153 EndScript 154 EndObject 155 TextButton "Prev" 156 Definition 157 Origin 247,155 158 Font "System",8 ; FontName, PointSize 159 PrintStyle SHADOW ,2,3 ; Style, Pen1, Pen2 160 TextColors 1,0,NORMAL ; PenA, PenB, DrawMode 161 Text " Prev " 162 Border BEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen 163 Highlight COMPLEMENT 164 ButtonFlags NONE 165 EndScript 166 OnRelease 167 Let Address[CurIndex]=GetDBObjects ;save current record 168 Let CurIndex=PreviousArrayIndex(Address,CurIndex) ;get previous record 169 If Not SearchFound ;if no previous record 170 Let CurIndex=LastArrayIndex(Address) ;go to last record 171 EndIf 172 Do "Show Record" 173 EndScript 174 EndObject 175 TextButton "Next" 176 Definition 177 Origin 327,155 178 Font "System",8 ; FontName, PointSize 179 PrintStyle SHADOW ,2,3 ; Style, Pen1, Pen2 180 TextColors 1,0,NORMAL ; PenA, PenB, DrawMode 181 Text " Next " 182 Border BEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen 183 Highlight COMPLEMENT 184 ButtonFlags NONE 185 EndScript 186 OnRelease 187 Let Address[CurIndex]=GetDBObjects ;save current record 188 Let CurIndex=NextArrayIndex(Address,CurIndex) ;get next record 189 If Not SearchFound ;if no next record 190 Let CurIndex=FirstArrayIndex(Address) ;go to first record 191 EndIf 192 Do "Show Record" 193 EndScript 194 EndObject 195 TextButton "Load" 196 Definition 197 Origin 407,155 198 Font "System",8 ; FontName, PointSize 199 PrintStyle SHADOW ,2,3 ; Style, Pen1, Pen2 200 TextColors 1,0,NORMAL ; PenA, PenB, DrawMode 201 Text " Load " 202 Border BEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen 203 Highlight COMPLEMENT 204 ButtonFlags NONE 205 EndScript 206 OnRelease 207 Dispose Address ;delete current database 208 Let FN=AskForFileName("","Load an Address File") ;get a filename 209 If Exists(FN) ;if file exists 210 Let Address=LoadVariable(FN) ;load it 211 EndIf 212 Let CurIndex=FirstArrayIndex(Address) ;go to first record 213 Do "Show Record" 214 EndScript 215 EndObject 216 TextButton "Save" 217 Definition 218 Origin 487,155 219 Font "System",8 ; FontName, PointSize 220 PrintStyle SHADOW ,2,3 ; Style, Pen1, Pen2 221 TextColors 1,0,NORMAL ; PenA, PenB, DrawMode 222 Text " Save " 223 Border BEVEL ,2,1 ; BorderStyle, MainPen, ExtraPen 224 Highlight COMPLEMENT 225 ButtonFlags NONE 226 EndScript 227 OnRelease 228 Let Address[CurIndex]=GetDBObjects ;store current record 229 Let FN=AskForFileName("","Save an Address File") ;get a filename 230 SaveVariable Address,FN ;save it 231 EndScript 232 EndObject 233 * End of Card "DataEntry" 234 *************