;First dialog box demo Macro STOP list1$ = "list2.txt" var1$ = "" var10$ = "~~temp.txt" STOP CLEAR macro$ = GETSESSSTR(28) CHGDIR(macro$) MACROHALT(1) m0 = menubar? m1 = addbar addcommand(m1,2,"&WinComm Menu") sm1 = addmenu(m1,"&Dialog Boxes") addcommand(sm1,3,"F&LIST && VTEXT") addcommand(sm1,4,"&File Selection") addcommand(sm1,5,"M&ail") addcommand(sm1,6,"&Other Samples") sm2 = addmenu(m1,"&Graphic Menu") addcommand(sm2,7,"Maps") step showbar(m1) DIALOGBOX 71, 20, 235, 107, 21, "Graphics - Menu Bar - Dialog Boxes" LTEXT 7, 10, 219, 33, "This part of the TOUR will demonstrate several methods WinComm provides for data entry and option selection. Notice the Menu Bar has changed to allow different selections in this part of the Tour." LTEXT 7, 42, 221, 33, "Select each menu item and explore the many capabilities of WinComm. When you are finished, select WinComm Menu to halt this macro and redisplay WinComms normal Menu Bar." DEFCANCELBUTTON 90, 81, 50, 14, "&OK" DEND DO i = DIALOG? UNTIL(i != 255) main_loop: i = menu? if(i==2) gosub win_return else if(i==3) gosub flist_vtext else if(i==4) gosub fil_sel else if(i==5) gosub mail else if(i==6) gosub next else if(i==7) gosub maps GOTO main_loop ;****** Dialog Boxes|FLIST & VTEXT * flist_vtext: DIALOGBOX 10, 14, 274, 162, 17 CTEXT 86, 6, 77, 9, "Dialog Box Example" LTEXT 12, 15, 234, 19, "This dialog box is used to demonstrate the various types of controls that can be used within WinComm dialog boxes." FLISTBOX 8, 63, 155, 33, LIST1$, VAR2$ LTEXT 12, 37, 151, 24, "This is a File Linked List box which displays a list of items contained in a text file." LTEXT 11, 98, 153, 40, "When an Item is selected in the list box, the value of DIALOG? changes and the selected text is assigned to a variable. This Macro places that string in the Variable Text box below." VTEXT 10, 143, 150, 9, VAR2$ LTEXT 170, 36, 89, 17, "The list displayed is contained in the file:" VTEXT 180, 57, 63, 10, LIST1$ GROUPBOX 166, 30, 1, 126, "" LTEXT 171, 70, 87, 31, "which the Macro can change by selecting the Update Pushbutton below." GROUPBOX 7, 30, 261, 5, "" UPDATEPB 177, 105, 78, 14, "&Update Pushbutton" DEFPUSHBUTTON 177, 136, 78, 14, "&OK" GROUPBOX 170, 123, 98, 5, "" GROUPBOX 9, 136, 153, 18, "" GROUPBOX 177, 49, 69, 20, "" DEND test: ;DIALOG? returns 255 while there is no activity in the ;dialog box. DIALOG? is reset each time it is tested DO ;so its value must be assigned to a variable for processing i = DIALOG? ;If a pushbutton is selected or something in a list box UNTIL(i != 255) ;is selected, the value will change and the macro ;will fall through this loop ;code below tests for the selection of an UPDATEPUSHBUTTON ;DIALOG? returns 100 for the first UPDATEPUSHBUTTON ;101 for the second up to a maximum of 103 for the fourth IF(i == 100){ IF(CMP(list1$,"list2.txt") == FALSE)list1$ = "list2.txt" ELSE list1$ = "list1.txt" UPDATEDLG(17) ;Updates both the VETEXT and LIST BOX GOTO test } ;Tests for a selection in the List Box ;DIALOG? returns 200 for the first (F)LISTBOX ;101 for the second up to a maximum of 103 for the fourth IF(i == 200){ UPDATEDLG(16) ;Updates only VETEXT GOTO test } RETURN ;goes back to menu processing if neither the UPDATEPB or LISTBOX selected ;***** Dialog Boxes|File Selection ** fil_sel: ftmp$ = "dlgdmo.fil" b$ = "AGNY.DOC" fdescr$ = "General Information - Directory of Oklahoma Agencies" ;causes this item to be ;selected in the list box DIALOGBOX 57, 10, 199, 194, 17 CTEXT 45, 4, 108, 8, "Files Available on ORIGINS:" CTEXT 96, 13, 71, 9, "File Description:" VTEXT 77, 26, 115, 54, FDESCR$ UPDATEPB 29, 97, 62, 14, "&Receive File" UPDATEPB 111, 97, 62, 14, "&Cancel" FLISTBOX 8, 25, 64, 65, FTMP$, B$ LTEXT 5, 121, 190, 41, "This is an example of one use of the FLISTBOX and the code required to update the description when a file is selected. Select different files and notice the discription change. The pushbuttons above are not active." DEFPUSHBUTTON 65, 169, 69, 14, "&OK" CTEXT 20, 13, 41, 9, "File Name:" GROUPBOX 7, 111, 186, 5, "" GROUPBOX 75, 21, 120, 60, "" DEND testy: DO i = DIALOG? UNTIL(i != 255) ;this line has 3 statements but works just like the three lines ;under the label "test" IF(i == 100){ ;UPDATEPB pressed but don't do anything UPDATEDLG(0) ;resets DIALOG? GOTO testy } IF(i == 101){ ;the other UPDATEPB pressed but don't do anything UPDATEDLG(0) ;resets DIALOG? GOTO testy } IF(i == 200){ ;file selected in list box, fdescr$ = EXTRACT(CHAR(9),b$,2) ;extract description and display it. UPDATEDLG(16) ;Updates VETEXT GOTO testy } return ;go back to menu processing ;**** Dialog Boxes|Mail ** mail: date$ = left(strtime(time?),10) time$ = mid(strtime(time?),12,8) mail$ = "mail.txt" TO$ = "" SUBJ$ = "" DIALOGBOX 53, 10, 230, 212, 17 LTEXT 103, 4, 18, 9, "Mail" RTEXT 18, 18, 21, 9, "To:" EDIT 40, 15, 175, 13, TO$ RTEXT 7, 33, 32, 9, "Subject:" EDIT 40, 31, 175, 13, SUBJ$ RTEXT 19, 49, 20, 9, "Date:" EDIT 40, 47, 75, 13, DATE$ RTEXT 119, 49, 20, 9, "Time:" EDIT 140, 47, 75, 13, TIME$ SEDIT 8, 64, 216, 57, MAIL$ DEFPUSHBUTTON 36, 123, 71, 15, "&Save" CANCELBUTTON 123, 123, 72, 15, "&Discard" GROUPBOX 5, 138, 221, 5, "" LTEXT 9, 143, 212, 35, "This dialog box shows two other types of controls. The framed rectangles are EDIT boxes and allow text entry and editing. The box with the vertical scroll bar is also an EDIT box but its contents are stored in a disk file which can be" LTEXT 9, 175, 210, 35, "up to 16,000 characters in length. Create a mail message by filling in the blanks and check the SAVE button. After this dialog box disappears the Macro will display one of WinComms 'stock' dialog boxes for naming the mail file." DEND DO i = DIALOG? UNTIL(i != 255) IF(i == 0){ DIALOGBOX 77, 21, 154, 87, 17 LTEXT 7, 7, 140, 33, "You don't want to save a Mail message this time? If you haven't saved one yet you won't be able to read it later in the demonstration." DEFPUSHBUTTON 24, 44, 99, 14, "&OK I Will Send Mail" CANCELBUTTON 24, 62, 100, 14, "&Lets Go On" DEND DO j = DIALOG? UNTIL(j != 255) IF(j == 0)RETURN ;go back to menu processing ELSE GOTO mail } ELSE IF(i == 1){ mail_mess = FOPEN(4096,"~~temp.txt") ;create a temp file mail = FOPEN(2,mail$) ;open the file created by the SEDIT box FWRITELN(mail_mess,to$) ;add information to the temp file FWRITELN(mail_mess,subj$) FWRITELN(mail_mess,date$) FWRITELN(mail_mess,time$) DO str$ = FREAD(mail,255) ;copy the mail file to the temp file for display FWRITE(mail_mess,255,str$) UNTIL(NULL(str$) == TRUE) ;everything copied FCLOSE(mail_mess) FCLOSE(mail) DELETEFILE("mail.txt") a$ = ".MLE" IF(SAVEASDLG("Save Mail Message as what File Name",a$) == FALSE){ DIALOGBOX 77, 21, 154, 87, 17 LTEXT 7, 7, 140, 33, "You don't want to save a Mail message this time? If you haven't saved one yet you won't be able to read it later in the demonstration." DEFPUSHBUTTON 24, 44, 99, 14, "&OK I Will Send Mail" CANCELBUTTON 24, 62, 100, 14, "&Lets Go On" DEND DO j = DIALOG? UNTIL(j != 255) IF(j == 0){ DELETEFILE("~~temp.txt") RETURN } ELSE GOTO mail } ELSE RENAME("~~temp.txt",a$) } IF(FILEOPENDLG("Select Mail File For Reading","*.mle",var2$) == FALSE)RETURN ;cancel selected go back to menu GOSUB extractit var11$ = "~~temp.txt" DIALOGBOX 53, 10, 230, 202, 17 LTEXT 103, 4, 18, 9, "Mail" RTEXT 18, 18, 21, 9, "To:" VTEXT 43, 18, 175, 9, TO$ RTEXT 7, 33, 32, 9, "Subject:" VTEXT 43, 33, 175, 9, SUBJ$ RTEXT 19, 49, 20, 9, "Date:" VTEXT 42, 49, 72, 9, DATE$ RTEXT 119, 49, 20, 9, "Time:" VTEXT 143, 49, 75, 9, TIME$ STEXT 10, 62, 215, 58, VAR11$ UPDATEPB 36, 123, 71, 15, "&Read Another" CANCELBUTTON 123, 123, 72, 15, "&Finished" GROUPBOX 5, 138, 221, 5, "" LTEXT 9, 144, 212, 33, "This is an example of a dialog box for reading mail. The text box with the vertical scroll bar in this case is a STEXT box which is read only. The [Read Another] button is an UPDATEPB which displays a 'Stock Dialog Box' that allows" LTEXT 9, 176, 210, 24, "selection of another Mail file. When the new mail file is selected, this dialog box is updated with the information in the selected file." GROUPBOX 40, 12, 183, 16, "" GROUPBOX 40, 27, 183, 16, "" GROUPBOX 141, 43, 82, 16, "" GROUPBOX 40, 43, 77, 16, "" DEND read_mail: DO i = DIALOG? UNTIL(i != 255) IF(i == 100){ DELETEFILE("~~temp.txt") ;make for shure we get rid of that temp file IF(FILEOPENDLG("Select Mail File For Reading","*.mle",var2$) == FALSE){ GOTO read_mail } GOSUB extractit GOTO read_mail } DELETEFILE("~~temp.txt") ;that temp file better be gone by now!!! RETURN ;finished--back to menu processing ;***** Subroutine ** extractit: ;Subroutine to remove information fron the front of the mail file ;for display in the Read Mail Dialog box. mail = FOPEN(2,var2$) ;open the file selected in the FILEOPENDLG dialog box to$ = FREADLN(mail) ;extract information from the mail file and assign subj$ = FREADLN(mail) ;to the proper variables date$ = FREADLN(mail) time$ = FREADLN(mail) mail_mess = FOPEN(4096,"~~temp.txt") DO str$ = FREAD(mail,255) ;copy the rest of the mail file to a temprary file for display FWRITE(mail_mess,255,str$) UNTIL(NULL(str$) == TRUE) FCLOSE(mail) FCLOSE(mail_mess) UPDATEDLG(18) RETURN ;****** Dialog Boxes|Other Samples ** next: var1$ = "" spec$ = "spec.txt;20 30 40" ;assign the variable for the file to display in the FLIST box DIALOGBOX 90, 15, 185, 181, 17 LTEXT 52, 6, 81, 9, "Your current status" GROUPBOX 10, 13, 164, 35, "In training" CHECKBOX 19, 24, 42, 10, "Intern", VAR1 CHECKBOX 19, 36, 49, 10, "Resident", VAR2 CHECKBOX 90, 24, 66, 10, "Chief resident", VAR3 CHECKBOX 90, 36, 47, 10, "Fellow", VAR4 GROUPBOX 10, 50, 164, 48, "In practice" CHECKBOX 19, 61, 71, 10, "Administration", VAR5 CHECKBOX 19, 73, 46, 10, "Academic", VAR6 CHECKBOX 19, 86, 56, 10, "Military", VAR7 CHECKBOX 90, 61, 68, 10, "Private/group", VAR8 CHECKBOX 90, 73, 68, 10, "Locum tenens", VAR9 CHECKBOX 90, 86, 83, 10, "Contract Professional", VAR10 CHECKBOX 10, 105, 43, 10, "Other...", VAR11 EDIT 56, 103, 118, 12, VAR1$ LTEXT 48, 118, 93, 9, "Select your specialty" FLISTBOX 10, 128, 166, 32, SPEC$, VAR2$ DEFPUSHBUTTON 54, 157, 77, 14, "&OK" DEND cont1: DO dg = dialog? UNTIL(dg != 255) IF(DG == 200){ ;something selected in list box but we don't do anything with it here UPDATEDLG(0) GOTO cont1 } ELSE return ;finished with this, process those menus ;****** WinComm Menu ** win_return: ;somebody wants to go back to wincomms menu SHOWBAR(m0) i = GETSESSINT(68) PUTSESSINT(68,0) ; disable auto sizing OPEN("TOUR.WSF","",1) PUTSESSINT(68,i) ; disable auto sizing HALT ;******* Graphic Menu|Maps ** maps: ENABLEMENU(m1,2,1) ;disable all menu items while running the hotspot program ENABLEMENU(m1,3,1) ;the menus do not need to be disabled and could be fully ENABLEMENU(m1,4,1) ;functional, as the macro could continue to process MENU? ENABLEMENU(m1,5,1) ;but for a demo what do you want? ENABLEMENU(m1,6,1) ENABLEMENU(m1,7,1) SHOWBAR(m1) show(1) i = GETSESSINT(68) PUTSESSINT(68,0) OPEN("GRAPHIC.WSF","",0) PUTSESSINT(68,i) DIALOGBOX 87, 27, 201, 106, 21, "Button and Graphics Demo" LTEXT 16, 9, 169, 25, "This part of the Tour will allow you to make selections of Cities and States from a map." LTEXT 17, 40, 165, 34, "Select a region, then select Cities and States by clicking on the names. Click on USA Map then Complete to finish this part of the demo." DEFPUSHBUTTON 73, 79, 50, 14, "OK" DEND DO i = DIALOG? UNTIL(i != 255) FCLOSE(FOPEN(4096,macro$+"\fill.txt")) ;create a file called fill.txt Var1$ = macro$+"\fill.txt" first = 1 vra2$ = "" USA: DELOBJECT(0,0,0) USERWINDOW(5,0,100,16776960) METABKG(0,0,1,"us_color.wmf") BUTTON(-81,2459,1258,590,"1001,&WEST") BUTTON(2016,2276,1259,590,"1002,MOU&NTAIN") BUTTON(4208,3089,1259,570,"1003,&PLAINS") BUTTON(3708,5366,1258,589,"1004,&TEXAS") BUTTON(825,7439,1259,589,"1005,&ALASKA") BUTTON(4357,8455,1259,590,"1006,&HAWAII") BUTTON(6179,2707,1258,586,"1007,MID&WEST") BUTTON(6101,4951,1257,586,"1008,SO&UTH") BUTTON(8035,1488,1415,585,"1009,NO&RTHEAST") BUTTON(7930,3496,1420,589,"1010,S&OUTHEAST") SHOW(6) if(first==1){ first = 0 GOTO us_test } ;will come here if we have already been to the regions Var2$ = "" DIALOGBOX 60, 12, 207, 170, 17 LTEXT 55, 5, 108, 9, "States and Metros Selected" FLISTBOX 8, 20, 90, 140, VAR1$, VAR2$ DEFPUSHBUTTON 130, 123, 47, 14, " &Complete " PUSHBUTTON 130, 65, 47, 14, "&USA " LTEXT 103, 33, 82, 9, "To return to USA map " LTEXT 103, 42, 94, 9, "for additional regional " LTEXT 103, 50, 76, 9, "selections..." LTEXT 103, 97, 93, 9, "When no more selections " LTEXT 103, 106, 58, 9, "are desired..." DEND cont_it: DO dg = DIALOG? UNTIL(dg != 255) if(dg==1) GOTO exit if(dg==200){ UPDATEDLG(0) GOTO cont_it } us_test: i = object? IF(i == 1001) goto nope ;this is where we test to see which hotspot has been selected ELSE IF(i == 1002) goto Mountain ;just like processing menus ELSE IF(i == 1003) goto Plains ELSE IF(i == 1004) goto nope ELSE IF(i == 1005) goto AK_HI ELSE IF(i == 1006) goto AK_HI ELSE IF(i == 1007) goto nope ELSE IF(i == 1008) goto nope ELSE IF(i == 1009) goto NE ELSE IF(i == 1010) goto nope goto us_test ;------------------------------------------------P L A I N S -------------------------------------- plains: DELOBJECT(0,0,0) USERWINDOW(5,0,100,16776960) METABKG(0,0,1,"plains.wmf") BUTTON(1352,1291,1258,608,"1001,&Fargo") BUTTON(896,481,472,608,"1002,ND") BUTTON(3019,1595,2217,608,"1003,Minneapolis-St. Paul") BUTTON(3176,684,472,607,"1004,MN") BUTTON(1038,2557,471,608,"1006,SD") BUTTON(849,3873,472,608,"1009,NE") BUTTON(1447,5823,471,607,"1017,KS") BUTTON(3129,8177,472,608,"1020,OK") BUTTON(3805,7595,472,608,"1022,AR") BUTTON(3711,5139,471,608,"1015,MO") BUTTON(3318,3899,471,607,"1011,IA") BUTTON(1541,2684,1258,607,"1005,Sioux Falls") BUTTON(1682,3924,1258,608,"1007,Omaha") BUTTON(2154,5722,1337,607,"1012,Kansas City") BUTTON(1289,6506,1258,608,"1016,Wichita") BUTTON(1226,8380,1651,607,"1019,Oklahoma City") BUTTON(2358,7139,1258,608,"1018,Tulsa") BUTTON(4544,7949,1258,608,"1021,Little Rock") BUTTON(3679,5899,1258,607,"1013,St. Louis") BUTTON(3947,4203,1320,607,"1010,Des Moines") BUTTON(1226,4658,1258,608,"1008,Lincoln") BUTTON(4371,6608,1258,607,"1014,Springfield") SHOW(6) DIALOGBOX 275, 20, 159, 70, 28, "States and Metros" LTEXT 30, 4, 108, 8, "States and Metros Selected" FLISTBOX 8, 15, 92, 49, VAR1$, VAR2$ PUSHBUTTON 103, 22, 49, 14, "Remove " PUSHBUTTON 103, 44, 49, 14, "USA Map" DEND plains_test: dg = DIALOG? ;processing both dialog box and hotspot selection i = OBJECT? IF(i>0) goto get_HS1 ;a hotspot selected go find which one IF(dg==255) goto plains_test IF(dg==200){ ;something selected in list box. we just go back and look for UPDATEDLG(0) ;another selection. var2$ now has the selection if we want to GOTO Plains_test ; } ; IF(dg==2){ ;remove it here GOSUB remove GOTO plains_test } DESTROYDLG ;since this is a modless dialog box we must destroy it if either ;of the other pushbuttons are selected GOTO USA ;redisplay the US map get_HS1: IF(i == 1001) Var2$ = "ND-Fargo" ELSE IF(i == 1002) Var2$ ="ND NORTH DAKOTA" ELSE IF(i == 1003) Var2$ ="MN-Minneapolis/St. Paul" ELSE IF(i == 1004) Var2$ ="MN MINNESOTA" ELSE IF(i == 1005) Var2$ ="SD-Sioux Falls" ELSE IF(i == 1006) Var2$ ="SD SOUTH DAKOTA" ELSE IF(i == 1007) Var2$ ="NE-Omaha" ELSE IF(i == 1008) Var2$ ="NE-Lincoln" ELSE IF(i == 1009) Var2$ ="NE NEBRASKA" ELSE IF(i == 1010) Var2$ ="IA-Des Moines" ELSE IF(i == 1011) Var2$ ="IA IOWA" ELSE IF(i == 1012) Var2$ ="MO-Kansas City" ELSE IF(i == 1013) Var2$ ="MO-St. Louis" ELSE IF(i == 1014) Var2$ ="MO-Springfield" ELSE IF(i == 1015) Var2$ ="MO MISSOURI" ELSE IF(i == 1016) Var2$ ="KS-Wichita" ELSE IF(i == 1017) Var2$ ="KS KANSAS" ELSE IF(i == 1018) Var2$ ="OK-Tulsa" ELSE IF(i == 1019) Var2$ ="OK-Oklahoma City" ELSE IF(i == 1020) Var2$ ="OK OKLAHOMA" ELSE IF(i == 1021) Var2$ ="AR-Little Rock" ELSE IF(i == 1022) Var2$ ="AR ARKANSAS" finfo1 = FOPEN(2,Var1$) ;add the selected fseek(finfo1,0,2) fwriteln(finfo1,Var2$) ;state or city to fclose(finfo1) var2$ = "" ;the file updatedlg(1) ;display the change to the file in the list box goto plains_test ;******** Alaska or Hawaii Selected ** ;******** See Comments in Plains Section ** ak_hi: ;STATUSLINE("ALASKA OR HAWAII") DELOBJECT(0,0,0) USERWINDOW(5,0,100,16776960) METABKG(0,0,1,"ak_hi.wmf") BUTTON(2028,2658,1258,608,"1003,Honolulu") BUTTON(7248,4987,1258,608,"1001,&Anchorage") BUTTON(2689,405,408,608,"1004,HI") BUTTON(7657,3443,409,608,"1002,AK") SHOW(6) DIALOGBOX 20, 120, 166, 71, 28, "States and Metros" LTEXT 30, 4, 108, 8, "States and Metros Selected" FLISTBOX 8, 15, 92, 49, VAR1$, VAR2$ PUSHBUTTON 107, 32, 49, 14, "Remove " PUSHBUTTON 108, 50, 49, 14, "USA Map" DEND akhi_test: dg = dialog? i = OBJECT? if(i>0) GOTO get_HS4 if(dg==255) GOTO akhi_test if(dg==200){ updatedlg(0) GOTO akhi_test } if(dg==2){ gosub remove GOTO akhi_test } Destroydlg GOTO USA get_HS4: IF(i == 1001) Var2$ ="AK-Anchorage" ELSE IF(i == 1002) Var2$ ="AK ALASKA" ELSE IF(i == 1003) Var2$ ="HI-Honolulu" ELSE IF(i == 1004) Var2$ ="HI HAWAII" finfo1 = FOPEN(2,Var1$) ;add the selected fseek(finfo1,0,2) fwriteln(finfo1,Var2$) ;state or city to fclose(finfo1) var2$ = "" ;the file updatedlg(1) ;display the change to the file in the list box GOTO akhi_test ;******* North East Region Selected ** ;******* See Comments in Plains Section ** NE: DELOBJECT(0,0,0) USERWINDOW(5,0,100,16776960) METABKG(0,0,1,"ne.wmf") BUTTON(7893,4709,1258,607,"1013,Boston") BUTTON(4403,5241,1257,607,"1001,&Buffalo") BUTTON(4340,8000,1431,608,"1005,Philadelphia") BUTTON(2453,7595,1257,608,"1004,Pittsburgh") BUTTON(6557,6532,1257,607,"1008,Hartford") BUTTON(6399,7316,1573,608,"1002,New York City") BUTTON(7862,6127,1257,607,"1010,Providence") BUTTON(7091,5063,425,608,"1012,MA") BUTTON(8286,1899,425,607,"1016,ME") BUTTON(5676,4380,456,607,"1003,NY") BUTTON(4308,7139,362,608,"1006,PA") BUTTON(5802,7291,472,608,"1007,NJ") BUTTON(6352,5848,472,608,"1009,CT") BUTTON(7421,5899,362,607,"1011,RI") BUTTON(7138,4127,441,607,"1015,NH") BUTTON(6494,4101,456,608,"1014,VT") SHOW(6) DIALOGBOX 18, 14, 166, 71, 28, "States and Metros" LTEXT 30, 4, 108, 8, "States and Metros Selected" FLISTBOX 8, 15, 92, 49, VAR1$, VAR2$ PUSHBUTTON 107, 32, 49, 14, "Remove " PUSHBUTTON 107, 50, 49, 14, "USA Map" DEND NE_test: dg = dialog? i = OBJECT? if(i>0) GOTO get_HS7 if(dg==255) GOTO NE_test if(dg==200){ updatedlg(0) GOTO ne_test } if(dg==2){ gosub remove GOTO ne_test } Destroydlg GOTO USA get_HS7: IF(i == 1001) Var2$ ="NY-Buffalo" ELSE IF(i == 1002) Var2$ = "NY-New York City" ELSE IF(i == 1003) Var2$ = "NY NEW YORK" ELSE IF(i == 1004) Var2$ = "PA-Pittsburgh" ELSE IF(i == 1005) Var2$ = "PA-Philadelphia" ELSE IF(i == 1006) Var2$ = "PA PENNSYLVANIA" ELSE IF(i == 1007) Var2$ = "NJ NEW JERSEY" ELSE IF(i == 1008) Var2$ = "CT-Hartford" ELSE IF(i == 1009) Var2$ = "CT CONNECTICUT" ELSE IF(i == 1010) Var2$ = "RI-Providence" ELSE IF(i == 1011) Var2$ = "RI RHODE ISLAND" ELSE IF(i == 1012) Var2$ = "MA MASSACHUSETTS" ELSE IF(i == 1013) Var2$ = "MA-Boston" ELSE IF(i == 1014) Var2$ = "VT VERMONT" ELSE IF(i == 1015) Var2$ = "NH NEW HAMPSHIRE" ELSE IF(i == 1016) Var2$ = "ME MAINE" finfo1 = FOPEN(2,Var1$) ;add the selected fseek(finfo1,0,2) fwriteln(finfo1,Var2$) ;state or city to fclose(finfo1) var2$ = "" ;the file updatedlg(1) ;display the change to the file in the list box GOTO ne_test ;******* Mountain Region Selected ** ;******* See Comments in Plains Section ** MOUNTAIN: DELOBJECT(0,0,0) USERWINDOW(5,0,100,16776960) METABKG(0,0,1,"mountain.wmf") BUTTON(2437,1215,1258,608,"1001,&Billings") BUTTON(3129,3646,1258,607,"1005,Cheyenne") BUTTON(1714,2304,1258,607,"1003,Boise") BUTTON(1855,4861,1526,607,"1007,Salt Lake City") BUTTON(204,6506,1258,608,"1013,Las Vegas") BUTTON(2374,9139,1258,607,"1016,Tucson") BUTTON(802,7722,1258,608,"1015,Phoenix") BUTTON(3742,7797,1462,608,"1011,Albuquerque") BUTTON(3223,5519,1258,608,"1009,Denver") BUTTON(3695,2810,472,608,"1006,WY") BUTTON(4072,861,472,607,"1002,MT") BUTTON(1619,1316,472,608,"1004,ID") BUTTON(943,4582,472,608,"1014,NV") BUTTON(2390,5595,472,608,"1008,UT") BUTTON(2390,7114,472,608,"1017,AZ") BUTTON(3381,6911,471,608,"1012,NM") BUTTON(4780,5241,472,607,"1010,CO") SHOW(6) DIALOGBOX 275, 20, 159, 70, 28, "States and Metros" LTEXT 30, 4, 108, 8, "States and Metros Selected" FLISTBOX 8, 15, 92, 49, VAR1$, VAR2$ PUSHBUTTON 103, 22, 49, 14, "Remove " PUSHBUTTON 103, 44, 49, 14, "USA Map" DEND MOUNTAIN_test: dg = dialog? i = OBJECT? if(i>0) GOTO get_HS9 if(dg==255) GOTO mountain_test if(dg==200){ updatedlg(0) GOTO mountain_test } if(dg==2){ GOSUB remove GOTO mountain_test } Destroydlg GOTO usa get_hs9: IF(i == 1001) Var2$ ="MT-Billings" ELSE IF(i == 1002) Var2$ ="MT MONTANA" ELSE IF(i == 1003) Var2$ ="ID-Boise" ELSE IF(i == 1004) Var2$ ="ID IDAHO" ELSE IF(i == 1005) Var2$ ="WY-Cheyenne" ELSE IF(i == 1006) Var2$ ="WY WYOMING" ELSE IF(i == 1007) Var2$ ="UT-Salt Lake City" ELSE IF(i == 1008) Var2$ ="UT UTAH" ELSE IF(i == 1009) Var2$ ="CO-Denver" ELSE IF(i == 1010) Var2$ ="CO COLORADO" ELSE IF(i == 1011) Var2$ ="NM-Albuquerque" ELSE IF(i == 1012) Var2$ ="NM NEW MEXICO" ELSE IF(i == 1013) Var2$ ="NV-Las Vegas" ELSE IF(i == 1014) Var2$ ="NV NEVADA" ELSE IF(i == 1015) Var2$ ="AZ-Phoenix" ELSE IF(i == 1016) Var2$ ="AZ-Tucson" ELSE IF(i == 1017) Var2$ ="AZ ARIZONA" finfo1 = FOPEN(2,Var1$) fseek(finfo1,0,2) fwriteln(finfo1,Var2$) fclose(finfo1) var2$ = "" updatedlg(1) goto MOUNTAIN_test nope: alert("To save disk space for Demo purposes, only the Plains, North East, and Mountain Regions are available.") GOTO us_test ;****** Subroutine to remove the selection in a FLISTBOX *** remove: if(null(var2$) == true)return temp = fopen(4096,"temp.txt") recfdir = fopen(2,var1$) fseek(recfdir,0,0) dl_sel$ = freadln(recfdir) while(null(dl_sel$) == false) if(cmp(left(dl_sel$,(len(dl_sel$) - 2)),var2$) == true) goto skip fwrite(temp,len(dl_sel$),dl_sel$) skip: dl_sel$ = freadln(recfdir) wend var2$ = "" fclose(temp) fclose(recfdir) deletefile(var1$) rename("temp.txt",var1$) updatedlg(1) return exit: DELOBJECT(0,0,0) DELETEFILE(var1$) ;finished with the graphic hotspot demo SHOW(8) ;show the cleared screen ENABLEMENU(m1,2,0) ;re-enable the menu items ENABLEMENU(m1,3,0) ENABLEMENU(m1,4,0) ENABLEMENU(m1,5,0) ENABLEMENU(m1,6,0) ENABLEMENU(m1,7,0) SHOWBAR(m1) GOTO main_loop ;go back to menu bar processing end