home *** CD-ROM | disk | FTP | other *** search
/ PSION CD 2 / PsionCDVol2.iso / Programs / 532 / RMRRCG.sis / RMREvent.opl (.txt) < prev    next >
Encoding:
EPOC OPL Source  |  1999-02-20  |  14.1 KB  |  612 lines

  1.  
  2.  
  3. APP RMREvent,42
  4.     ICON "RMREvent.icn"
  5.     FLAGS 1
  6. ENDA
  7.  
  8. INCLUDE "CONST.OPH"
  9. INCLUDE "PRINTER.OXH"
  10. INCLUDE "SYSTEM.OXH"
  11. INCLUDE "DBASE.OXH"
  12. INCLUDE "RMREVENT.OSG"
  13.  
  14. CONST RMREvent_UID&=4
  15. CONST Key_Pressed=&400
  16. CONST Program_To_Foreground=&401
  17. CONST Program_To_Background=&402
  18. CONST Open_or_Close_Document=$404
  19. CONST Key_Down=&406
  20. CONST Key_Up=&407
  21. CONST Pointer_Used=&408
  22. CONST Pointer_Enter=&409
  23. CONST Pointer_Exit=&40A
  24. CONST KCmdLetterExit$="X"
  25. CONST Forever=0
  26.  
  27. PROC Start:
  28.     LOADM "Z:\SYSTEM\OPL\TOOLBAR.OPO"
  29.     TBarLink:("Main")
  30. ENDP
  31.  
  32. PROC Main:
  33.     GLOBAL Key&,A&(20),DocumentName$(255),SystemCommandLetter$(3),Toolbar%,A%,Dev$(3)
  34.     GLOBAL Mod%,Control%,Shift%,ScreenWidth%,off%(6),RID&
  35.     GLOBAL One&,Two&,Three&,Four&,Minit%,Mainscn%,Screen2%,Buffer&(65),TextString$(255)
  36.     GLOBAL Icon$(50),RSC$(50),Path$(255),Data$(255),LastUsed$(255),Thread&,Program$(20),Version$(5)
  37.     GLOBAL Scrollscn%,Upid&,Downid&,Sliderid&,Findid&,Scrollpos%,Screenheight%,RMRId&
  38.                         
  39.     DocumentName$=CMD$(2)
  40.     SystemCommandLetter$=CMD$(3)
  41.  
  42.     Program$="RMREvent"
  43.     Version$="1.8"
  44.     
  45.     Init:
  46.     ActionSystemEvent:
  47.     DO
  48.         Run:
  49.     UNTIL Forever
  50. ENDP
  51.  
  52. PROC Run:
  53.     ONERR Handler::
  54.     DO
  55.         GETEVENT32 A&()
  56.         IF A&(1)=Open_or_Close_Document
  57.             DocumentName$=GETCMD$
  58.             SystemCommandLetter$=LEFT$(DocumentName$,1) :     DocumentName$=MID$(DocumentName$,2,255)
  59.             ActionSystemEvent:
  60.             A&(1)=Program_To_Foreground
  61.         ELSEIF A&(1)=Program_To_Background
  62.             Background:
  63.         ELSEIF A&(1)=Program_To_Foreground
  64.             Foreground:
  65.         ELSE
  66.             REM Determine status of modifier keys
  67.             Mod%=A&(4) AND 255
  68.             IF Mod% AND 2
  69.                 Shift%=KTrue%
  70.             ELSE
  71.                 Shift%=KFalse%
  72.             ENDIF
  73.             IF Mod% AND 4
  74.                 Control%=KTrue%
  75.             ELSE
  76.                 Control%=KFalse%
  77.             ENDIF
  78.             Key&=A&(1)
  79.             Action_Pen_or_Keypress:
  80.         ENDIF
  81.     UNTIL Forever
  82.     Handler::
  83.     ONERR OFF
  84.     Error_Handler:(Program$)
  85. ENDP
  86.  
  87. PROC Action_Pen_or_Keypress:
  88.     IF Key&=Key_Up OR Key&=Key_Down
  89.         RETURN
  90.     ELSEIF Key&=Pointer_Used
  91.         IF TBarOffer%:(A&(3),A&(4),A&(6),A&(7))
  92.             RETURN
  93.         ELSEIF A&(4)=1
  94.             Pointer_Event:(A&(3),A&(6),A&(7))
  95.         ENDIF
  96.     ELSEIF Key&=10001
  97.         giPRINT "Cut/Copy/Paste"
  98.     ELSEIF Key&=10002
  99.         giPRINT "InfraRed"
  100.     ELSEIF Key&=10003
  101.         giPRINT "Zoom in"
  102.     ELSEIF Key&=10004
  103.         giPRINT "Zoom out"
  104.     ELSEIF Key&=4101 : giPRINT "Page Down"
  105.     ELSEIF Key&=4100 : giPRINT "Page Up"
  106.     ELSEIF Key&=4099 : giPRINT "End"
  107.     ELSEIF Key&=4098 : giPRINT "Home"
  108.     ELSEIF Key&=4106 : giPRINT "Cursor Down"
  109.     ELSEIF Key&=4105 : giPRINT "Cursor Up"
  110.     ELSEIF Key&=4104 : giPRINT "Cursor Right"
  111.     ELSEIF Key&=4103 : giPRINT "Cursor Left"
  112.     ELSEIF Key&=4150 OR Key&=10000
  113.         Display_Menu:
  114.     ENDIF
  115.     IF Shift%
  116.         Key&=Key&-32
  117.     ENDIF
  118.     IF Key&<=300
  119.         Action_Key:
  120.     ENDIF
  121.     Shift%=0 : Control%=0
  122. ENDP
  123.  
  124. PROC Display_Menu:
  125.     mINIT
  126.     mCASC "Printing","Page setupΓǪ",%U,"Print setupΓǪ",%P,"Print previewΓǪ",%V,"PrintΓǪ",%p
  127.     mCARD "File","Create new documentΓǪ",%n,"Open existing documentΓǪ",-%o,"Printing>",-16,"Close",%e
  128.     mCARD "Edit","Text",%u
  129.     mCARD "View","Zoom in",%m,"Zoom out",-%M,"Show toolbar",%t OR -$2800*Toolbar%
  130.     mCARD "Tools","Help on RMREventΓǪ",%H,"About RMREventΓǪ",%A
  131.     Key&=MENU(Minit%)-96
  132.     Control%=KTrue%
  133. ENDP
  134.  
  135. PROC Action_Key:
  136.     LOCAL G$(20)
  137.     Printkey:
  138.     IF     Key&=ASC("n")-96 : Newfile:
  139.     ELSEIF Key&=ASC("o")-96 : Open_Existing_file:
  140.     ELSEIF Key&=ASC("t")-96 : ToolSwitch:
  141.     ELSEIF Key&=ASC("e")-96 : Exit:
  142.     ELSEIF Key&=ASC("H")-96 : Help:
  143.     ELSEIF Key&=ASC("A")-96 : About:
  144.     ELSEIF Key&=ASC("u")-96 : TextEditor:
  145.     ELSEIF Key&=ASC("m")-96 AND Control%=KTrue% : giPRINT "Zoom in" : Key&=0
  146.     ELSEIF Key&=ASC("M")-96 AND Control%=KTrue% : giPRINT "Zoom out" : Key&=0
  147.  
  148.     ELSE
  149.  
  150. REM  Add your application specific keys here
  151. REM  The following code just displays the keypress
  152.  
  153.         IF Shift% : G$="Shift+" : Key&=Key&+32 : ENDIF
  154.         IF Key&=13
  155.             giPRINT "Enter"
  156.         ELSEIF Key&=9
  157.             giPRINT "Tab"
  158.         ELSEIF Key&=8
  159.             giPRINT "Delete"
  160.         ELSEIF Key&=27
  161.             giPRINT "Escape"
  162.         ELSEIF Key&=32
  163.             giPRINT "Space Bar"
  164.         ELSEIF Key&>96
  165.             giPRINT G$+CHR$(Key&-32)
  166.         ELSEIF Control%
  167.             giPrINT G$+"Ctrl+"+CHR$(Key&+64)
  168.         ELSE
  169.             giPrINT G$+CHR$(Key&)
  170.         ENDIF
  171.         
  172.     ENDIF
  173. ENDP
  174.  
  175. PROC Printkey:
  176.     ResetPrinting:
  177.     IF Key&=ASC("U")-96 : PageSetupDialog:
  178.     ELSEIF Key&=ASC("P")-96 : PrintRangeDialog:
  179.     ELSEIF Key&=ASC("V")-96
  180.         ONERR Printquit::
  181.         Print: : PrintPreviewDialog:    
  182.     ELSEIF Key&=ASC("p")-96
  183.         ONERR Printquit::
  184.         Print: : PrintDialog:
  185.     ENDIF
  186.     ONERR OFF : RETURN
  187.     Printquit::
  188.     ONERR OFF
  189.     giPRINT "Problem with Printer"
  190. ENDP
  191.  
  192. PROC ActionSystemEvent:
  193.     IF SystemCommandLetter$=KCmdLetterCreate$ 
  194.         Create:(DocumentName$)
  195.     ELSEIF SystemCommandLetter$=KCmdLetterOpen$
  196.         Openfile:
  197.     ELSEIF SystemCommandLetter$=KCmdLetterRun$
  198.         Resumefile: 
  199.     ELSEIF SystemCommandLetter$=KCmdLetterExit$
  200.         STOP
  201.     ENDIF
  202. ENDP
  203.  
  204. PROC Init:
  205.     Screenheight%=gHEIGHT
  206.     Path$="\System\Apps\RMREvent\"
  207.     Data$="C:\System\Apps\RMREvent\"
  208.     Toolbar%=KTrue%
  209.     TRAP MKDIR Data$
  210.     Load_INI_File:
  211.     Setup_Toolbar:
  212.     RSC$=Path$+"RMREvent.rsc"
  213.     IF Device:(RSC$)
  214.     rId&=LoadRsc&:(Dev$+RSC$)
  215.   ELSE
  216.     dINIT "File not found"
  217.     dTEXT "","RMREvent.RSC not found",2
  218.     dBUTTONS "OK",($300 or 13)
  219.     DIALOG
  220.         STOP
  221.   ENDIF
  222.     Icon$=Path$+"RMREvent.mbm"
  223.     IF Device:(Icon$)
  224.         Icon$=Dev$+Icon$
  225.         Upid&=gLOADBIT(Icon$,0,0)
  226.         Downid&=gLOADBIT(Icon$,0,1)
  227.         Sliderid&=gLOADBIT(Icon$,0,2)
  228.         FindId&=gLOADBIT(Icon$,0,3)
  229.         RMRId&=gLOADBIT(Icon$,0,7)
  230.     ELSE
  231.         ALERT ("MBM file not found")
  232.         STOP
  233.     ENDIF
  234.     MainScn%=gCREATE (0,0,Screenwidth%-23,Screenheight%,1,1)
  235.     gBORDER 0
  236.     Screen2%=gCREATE (200,145,300,60,1,1)
  237.     gBORDER 0
  238.     ScrollScn%=gCREATE (Screenwidth%-23,0,23,Screenheight%,0,1)
  239.     gBORDER 0
  240.     Scrollpos%=100
  241.     Setup_Scroll:
  242.     TBarButt:("a",1,"",0,One&,One&,0)
  243.     TBarButt:("b",2,"Find",0,FindId&,FindId&,0)
  244.     TBarButt:("c",3,"No\Yes",0,Three&,Three&,0)
  245.     TBarButt:("d",4,"Raise"+CHR$(10)+"Error",0,Four&,Four&,0)
  246.     Instructions:
  247. ENDP
  248.  
  249. PROC Setup_Scroll:
  250.     gUSE Scrollscn%
  251.     gAT 1,1 : gFILL 21,Screenheight%-2,1
  252.     gAT 0,Screenheight%-44
  253.     gCOPY Upid&,0,0,24,24,0
  254.     gAT 0,Screenheight%-22
  255.     gCOPY Downid&,0,0,24,24,0
  256.     gAT 0,Scrollpos%
  257.     gCOPY SliderId&,0,0,24,24,0
  258.     gVISIBLE ON
  259. ENDP
  260.  
  261. PROC Setup_Toolbar:
  262.     TBarInit:("Demo",gWidth,gHeight)
  263.     IF Toolbar%=KTrue%
  264.         TBarShow: : Screenwidth%=568
  265.     ELSE
  266.         TBarHide: : Screenwidth%=640
  267.     ENDIF
  268. ENDP
  269.  
  270. PROC Load_INI_File:
  271.     IF EXIST (Data$+"RMREvent.ini")
  272.         OPEN Data$+"RMREvent.ini",A,F1$
  273.         LastUsed$=A.F1$
  274.         NEXT
  275.         TextString$=A.F1$
  276.         CLOSE
  277.     ENDIF
  278. ENDP
  279.  
  280. PROC Save_INI_File:
  281.     TRAP DELETE Data$+"RMREvent.ini"
  282.     CREATE Data$+"RMREvent.ini",A,F1$
  283.     A.F1$=LastUsed$
  284.     APPEND
  285.     A.F1$=TextString$
  286.     APPEND
  287.     CLOSE
  288. ENDP
  289.  
  290. PROC Cmda%:
  291.     giPRINT "Button 1 on Toolbar pressed"
  292. ENDP
  293.  
  294. PROC Cmdb%:
  295.     giPRINT "'Find' Button on Toolbar pressed"
  296. ENDP
  297.  
  298. PROC Cmdc%:
  299.     dINIT "Example"
  300.     dTEXT "","A simple No/Yes dialog"
  301.     dBUTTONS "No",%n OR KDButtonNoLabel% OR KDButtonPlainKey%,"Yes",%y OR KDButtonNoLabel% OR KDButtonPlainKey%
  302.     IF DIALOG=%y
  303.         giPRINT "Yes"
  304.     ELSE
  305.         giPRINT "No"
  306.     ENDIF
  307. ENDP
  308.  
  309. PROC Cmdd%:
  310.     giPRINT "Button 4 on Toolbar pressed"
  311.     REM Raise an example error
  312.     RAISE -78
  313. ENDP
  314.  
  315. PROC Pointer_Event:(Window&,X_Position&,Y_Position&)
  316.     IF Window&=MainScn%
  317.         giPRINT "Pen/Pointer is on the main window at X - "+FIX$(X_Position&,0,9)+"  Y - "+FIX$(Y_Position&,0,9)
  318.     ELSEIF Window&=Screen2%
  319.         giPRINT "Pen/Pointer is on the secondary window at X - "+FIX$(X_Position&,0,9)+"  Y - "+FIX$(Y_Position&,0,9)
  320.     ELSEIF Window&=Scrollscn% 
  321.         IF Y_Position&<Scrollpos%
  322.             giPRINT "Pen/Pointer is on the scroll window above the slider",1
  323.             Scrollmove:(-30)
  324.         ELSEIF Y_Position&<Screenheight%-44
  325.             giPRINT "Pen/Pointer is on the scroll window below the slider",1
  326.             Scrollmove:(30)
  327.         ELSEIF Y_Position&<Screenheight%-22
  328.             giPRINT "Cursor Up",1
  329.             Scrollmove:(-10)
  330.         ELSE
  331.             giPRINT "Cursor Down",1
  332.             Scrollmove:(10)
  333.         ENDIF
  334.     ENDIF
  335. ENDP
  336.  
  337. PROC ScrollMove:(D%)
  338.     Scrollpos%=Scrollpos%+D%
  339.     IF Scrollpos%>Screenheight%-60
  340.         Scrollpos%=Screenheight%-60
  341.     ELSEIF Scrollpos%<0
  342.         Scrollpos%=0
  343.     ENDIF
  344.     Setup_scroll:
  345. ENDP
  346.  
  347. PROC Toolswitch:
  348.     gCLOSE MainScn% : gCLOSE Scrollscn% 
  349.     IF Toolbar%
  350.         Toolbar%=KFalse% : TBarHide: : Screenwidth%=640
  351.     ELSE 
  352.         Toolbar%=KTrue% :  TBarShow: : Screenwidth%=568
  353.     ENDIF
  354.     MainScn%=gCREATE (0,0,Screenwidth%,Screenheight%,1,1)
  355.     ScrollScn%=gCREATE (Screenwidth%-23,0,23,Screenheight%,0,1)
  356.     gBORDER 0
  357.     Setup_Scroll:
  358.     gORDER Screen2%,1
  359.     Instructions:
  360. ENDP
  361.  
  362. PROC ToolBarTitle:(A$)
  363.     REM 'Trim Filename to 7 characters to fit ToolBar
  364.     TBarSetTitle:(LEFT$(MID$(PARSE$(A$,DocumentName$,off%()),Off%(4),Off%(5)-Off%(4)),7))
  365. ENDP
  366.  
  367. PROC NewFile:
  368.     LOCAL File$(255),Ok%
  369.     DO
  370.         Ok%=KTrue%
  371.         dINIT "New data file"
  372.         dFILE File$,"File,Folder,Disk",1
  373.         dBUTTONS "Cancel",KDButtonEsc% OR KDButtonNoLabel% OR KDButtonPlainKey%,"OK",KDButtonEnter% OR KDButtonNoLabel% OR KDButtonPlainKey%
  374.         IF DIALOG=KDButtonEnter%    
  375.             IF NOT EXIST (File$)
  376.                 Create:(File$)
  377.             ELSE
  378.                 giPRINT "Document already exists"
  379.                 Ok%=KFalse%
  380.             ENDIF
  381.         ENDIF
  382.     UNTIL Ok%=KTrue%
  383. ENDP
  384.  
  385. PROC Create:(File$)
  386.     LOCAL Key1&
  387.     SETDOC File$
  388.     CREATE """"+File$+""" FIELDS Date,Number,Details TO Entries",A,F1&,F2%,F3$
  389.     USE A : CLOSE
  390.     Key1&=DbNewKey&:
  391.     DbAddField:(Key1&,"Date",1)
  392.     DbSetComparison:(Key1&,1)        
  393.     DbCreateIndex:("Date",Key1&,File$,"Entries")
  394.     DbDeleteKey:(Key1&)            
  395.     DocumentName$=File$
  396.     LastUsed$=File$
  397.     ToolBarTitle:(File$)
  398.     giPRINT "File created"
  399. ENDP
  400.  
  401. PROC Open_Existing_File:
  402.     LOCAL File$(255),Ret%
  403.     File$=DocumentName$
  404.     DO
  405.         dINIT "Open existing file"
  406.         dFILE File$,"File,Folder,Disk",2,0,KUidOplDoc&,RMREvent_UID&
  407.         dBUTTONS "Cancel",KDButtonEsc% OR KDButtonNoLabel% OR KDButtonPlainKey%,"OK",KDButtonEnter% OR KDButtonNoLabel% OR KDButtonPlainKey%
  408.         IF DIALOG=KDButtonEnter%    
  409.             DocumentName$=File$ : Ret%=Openfile:
  410.         ELSE : Ret%=KTrue%
  411.         ENDIF
  412.     UNTIL Ret%=KTrue%
  413. ENDP
  414.  
  415. PROC OpenFile:
  416.     LOCAL Order$(20),Filter$(20),Ok%
  417.     dINIT "Message"
  418.     dTEXT "","The program has been asked to open the"
  419.     dTEXT "","the file : "+DocumentName$
  420.     dBUTTONS "Close",KDButtonEnter% OR KDButtonNoLabel% OR KDButtonPlainKey%
  421.     IF DIALOG
  422.         SETDOC DocumentName$
  423.         Order$=" ORDER BY Date"
  424.         Filter$=" WHERE Number>4"
  425.         TRAP OPEN """"+DocumentName$+""" FOLDED SELECT Date,Number,Details FROM Entries"+Filter$+Order$,A,F1&,F2%,F3$
  426.         IF ERR
  427.             giPRINT "Not a valid RMREvent file"
  428.             RETURN KFalse%
  429.         ELSE
  430.             USE A : CLOSE
  431.             LastUsed$=DocumentName$
  432.             ToolBarTitle:(DocumentName$)
  433.             giPRINT "File Opened"
  434.             RETURN KTrue%
  435.         ENDIF
  436.     ENDIF
  437. ENDP
  438.  
  439. PROC ResumeFile:
  440.     IF LastUsed$="" OR EXIST (LastUsed$)=0
  441.         dINIT "Message"
  442.         dTEXT "","The program has been asked to open"
  443.         dTEXT "","the last used file, but it doesn't"
  444.         dTEXT "","exist.  You will therefore be asked"
  445.         dTEXT "","to create a new one."
  446.         dBUTTONS "Close",KDButtonEnter% OR KDButtonNoLabel% OR KDButtonPlainKey%
  447.         DIALOG
  448.         NewFile:
  449.     ELSE
  450.         DocumentName$=LastUsed$
  451.         SETDOC DocumentName$
  452.         Openfile:
  453.         ToolBarTitle:(DocumentName$)
  454.     ENDIF
  455. ENDP
  456.  
  457. PROC Background:
  458.     LOCAL E&(16),Keytosend&,Modtosend&,Caped&
  459.     giPRINT "Program has moved to background",2
  460.     Keytosend&=5  REM <Ctrl+Fn+E>  (A=1,B=2..., but avoid "S")
  461.     Modtosend&=KModifierCtrl&+KModifierFunc&
  462.     Caped&=CaptureKey&:(Keytosend&,Modtosend&,Modtosend&)
  463.     DO
  464.         GETEVENT32 E&()
  465.         IF E&(1)=Open_or_Close_Document
  466.             DocumentName$=GETCMD$
  467.             SystemCommandLetter$=LEFT$(DocumentName$,1)
  468.             DocumentName$=MID$(DocumentName$,2,255)
  469.             E&(1)=Program_To_Foreground
  470.             ActionSystemEvent:
  471.         ENDIF
  472.     UNTIL E&(1)<&60 OR E&(1)=Program_To_Foreground
  473.     CancelCaptureKey:(Caped&)
  474.     IF E&(1)<&60
  475.         SetForeground:
  476.     ENDIF
  477. ENDP
  478.  
  479. PROC Foreground:
  480.     giPRINT "Program has moved to foreground",2
  481. ENDP
  482.  
  483. PROC Print:
  484.     ResetPrinting:
  485.     SetFontName:("Courier")
  486.     SetFontHeight:(200)
  487.     SendStringToPrinter:("Printer Demonstration")
  488.     SendNewParaToPrinter:
  489.     SendBitmapToPrinter:(RMRId&)
  490. ENDP
  491.  
  492. PROC About:
  493.     dINIT "Event Driven Core"
  494.     dTEXT "","Version "+Version$
  495.     dTEXT "","Produced by Al Richey"
  496.     dTEXT "","feel free to use it as a"
  497.     dTEXT "","basis for your programs"
  498.     dBUTTONS "OK",KDButtonEnter% OR KDButtonNoLabel% OR KDButtonPlainKey%
  499.     DIALOG
  500. ENDP
  501.  
  502. PROC Help:
  503.     LOCAL HelpFile$(255)
  504.     IF Device:(Path$+"RMREvent.hlp")
  505.         Helpfile$=Dev$+Path$+"RMREvent.hlp"
  506.         IF Thread&<>0
  507.             ONERR Notopen::
  508.             SetForegroundByThread&:(Thread&,0)
  509.         ELSE
  510.             Notopen::
  511.             ONERR OFF
  512.             Thread&=RunApp&:("Data",Helpfile$,"",0)
  513.         ENDIF
  514.     ELSE
  515.         giPRINT "Help file not found"
  516.     ENDIF
  517. ENDP
  518.  
  519. PROC Exit:
  520.     Save_INI_File:
  521.     IF Thread&<>0
  522.         ONERR Exitanyway::
  523.         EndTask&:(Thread&,0)
  524.     ENDIF
  525.     Exitanyway::
  526.     STOP
  527. ENDP
  528.  
  529. PROC Instructions:
  530.     gUSE MainScn%
  531.     gAT 1,1 : gBUTTON "",1,60,60,0,RMRId&,RMRId&
  532.     gFONT KFontArialNormal18&
  533.     gAT 70,20 : gPRINT "OPL Event-Driven Core (┬⌐ Al Richey)"
  534.     gAT 70,22 : gLINEBY 300,0
  535.     gFONT KFontArialNormal13&
  536.     gSTYLE KgStyleItalic%
  537.     gAT 80,40 : gPRINT "(provided to help programmers)"
  538.     gFONT KFontArialNormal15&
  539.     gAT 360,50 : gPRINT ReadRsc$:(Version_&)
  540.     gAT 10,80 : gPRINT ReadRsc$:(Instructions1_&)
  541.     gAT 10,100 : gPRINT ReadRsc$:(Instructions2_&)
  542.     gAT 10,120 : gPRINT ReadRsc$:(Instructions3_&)
  543.     gAT 10,140 : gPRINT ReadRsc$:(Instructions4_&)
  544.     gAT 10,160 : gPRINT ReadRsc$:(Instructions5_&)
  545.     gAT 10,180 : gPRINT ReadRsc$:(Instructions6_&)
  546.     gAT 10,200 : gPRINT ReadRsc$:(Instructions7_&)
  547.     gSTYLE 0
  548.     gAT 10,225 : gPRINT ReadRsc$:(Instructions8_&)
  549. REM    gAT 10,225 : gPRINT ReadRsc$:(Blank_&)
  550.     gUSE Screen2%
  551.     gFONT KFontArialNormal27&
  552.     gAT 20,40 : gPRINT "Secondary Window"
  553. ENDP
  554.  
  555. PROC Error_Handler:(P$)
  556.     DINIT "",2
  557.     dTEXT "","Sorry. it seems an unexpected error has occured"
  558.     dTEXT "","Please E-mail me at : xxxxxxxx.xxxx@xxxx.com"
  559.     dTEXT "","and tell me the EXACT circumstances and the key"
  560.     dTEXT "","presses that led to this error.  I will also need"
  561.     dTEXT "","the following additional information :"
  562.     dTEXT "","",$800
  563.     dTEXT "",P$+" Version "+Version$
  564.     dTEXT "","There has been an "+ERRX$
  565.     dTEXT "","The error was : "+ERR$(ERR)
  566.     dBUTTONS "Continue",13 OR $300
  567.     DIALOG
  568. ENDP
  569.  
  570. PROC Device:(F$)
  571.     Dev$="C:"
  572.     IF EXIST (Dev$+F$) : RETURN KTrue%
  573.     ELSE 
  574.         Dev$="D:"
  575.         IF EXIST (Dev$+F$)
  576.             RETURN KTrue%
  577.         ELSE
  578.             RETURN KFalse%
  579.         ENDIF
  580.     ENDIF
  581. ENDP
  582.  
  583. PROC TextEditor:
  584.     Buffer:(TextString$)
  585.     dINIT "Text Editor"
  586.     dEDITMULTI ADDR(buffer&(1)),"",30,5,240
  587.     dBUTTONS "Cancel",KDButtonEsc% OR KDButtonNoLabel% OR KDButtonPlainKey%,"Save",%s
  588.     IF DIALOG=%s
  589.         TextString$=Buffer$:
  590.     ENDIF
  591. ENDP
  592.  
  593. PROC Buffer$:
  594.     LOCAL C4&,A$(255)
  595.     C4&=ADDR(Buffer&(1))
  596.     POKEB C4&+3,PEEKB (C4&)
  597.     A$=PEEK$(C4&+3)
  598.     POKEB C4&+3,0
  599.     RETURN A$
  600. ENDP
  601.  
  602. PROC Buffer:(A$)
  603.     LOCAL C4&
  604.     C4&=ADDR(Buffer&(1))
  605.     POKE$ C4&+3,A$
  606.     POKEB C4&,PEEKB (C4&+3)
  607.     POKEB C4&+3,0
  608. ENDP
  609.  
  610.  
  611.  
  612.