home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / developmen / oplexamp / EX_IOSCR.OPL < prev    next >
Text File  |  1992-08-27  |  2KB  |  126 lines

  1. PROC iotest:
  2. GLOBAL x1%,x2%,y1%,y2%
  3. LOCAL i%,h$(4),a$(5)
  4.     x1%=2 :y1%=2
  5.     x2%=25 :y2%=5 REM our test screensize
  6.     SCREEN x2%-x1%,y2%-y1%,x1%,y1%
  7.     AT 1,1
  8.     PRINT "Text window IO test"
  9.     PRINT "PSION-Esc quits"
  10.     h$="FSCR" REM our hot-keys
  11.     DO
  12.         i%=GET
  13.         IF i%=$122 REM Menu key
  14.             mINIT
  15.             mCARD "Set","Font",%F,"Style",%S,"Rect",%R
  16.             mCARD "Sense","Cursor",%C
  17.             i%=MENU
  18.             IF i% AND INTF(LOC(h$,CHR$(i%)))
  19.                  a$="proc"+chr$(i%)
  20.                 @(a$): 
  21.             ENDIF
  22.         ELSEIF i% AND $200 REM hot-key
  23.             i%=(i%-$200) AND $FFDF REM Uppercase it
  24.             i%=LOC(h$,CHR$(i%)) REM One of ours?
  25.             IF i%
  26.                  a$="proc"+MID$(h$,i%,1)
  27.                 @(a$):
  28.             ENDIF REM ignore other weird keypresses
  29.         ELSE REM some other key, so return it
  30.             PRINT CHR$(i%);
  31.         ENDIF
  32.     UNTIL 0
  33. ENDP
  34.  
  35.  
  36.  
  37. PROC procf:
  38.     LOCAL n%,i%,a%
  39.     dINIT "Font for text window"
  40.     dCHOICE n%,"Font","Normal,bold,digit"
  41.     dCHOICE i%,"Bold","No,Yes"
  42.     dCHOICE a%,"Double","No,Yes"
  43.     IF DIALOG
  44.         CLS
  45.         iofont:(n%,(i%-1)+8*(a%-1))
  46.     ENDIF
  47. ENDP
  48.  
  49.  
  50.  
  51. PROC procs:
  52.     LOCAL r%,u%
  53.     dINIT "Style for text window"
  54.     dCHOICE r%,"Inverse","No,Yes"
  55.     dCHOICE u%,"Underline","No,Yes"
  56.     IF DIALOG
  57.         iostyle:((u%-1)*4+(r%-1)*2)
  58.     ENDIF
  59. ENDP
  60.  
  61.  
  62.  
  63. PROC procc:
  64.     LOCAL a&
  65.     a&=iocurs&:
  66.     PRINT "x";1+(a& AND &ffff);
  67.     PRINT "y";1+(a&/&10000);
  68. ENDP
  69.  
  70.  
  71.  
  72. PROC procr:
  73.     LOCAL xx1%,yy1%,xx2%,yy2%
  74.     LOCAL xx1&,yy1&,xx2&,yy2&
  75.     dINIT "Clear rectangle"
  76.     dLONG xx1&,"Top left x",1,x2%-x1%
  77.     dLONG yy1&,"Top left y",1,y2%-y1%
  78.     dLONG xx2&,"Bottom left x",2,x2%-x1%
  79.     dLONG yy2&,"Bottom left y",2,y2%-y1%
  80.     IF DIALOG
  81.         xx1%=xx1&-1 :xx2%=xx2&-1
  82.         yy1%=yy1&-1 :yy2%=yy2&-1
  83.         iorect:(xx1%,yy1%,xx2%,yy2%)
  84.     ENDIF
  85. ENDP
  86.  
  87.  
  88.  
  89. PROC iofont:(font%,style%)
  90.     LOCAL i%,a%(6)
  91.     i%=17 :REM font option
  92.     a%(1)=$4000+font%-1
  93.     a%(2)=style%
  94.     IOW(-2,7,i%,a%())
  95. ENDP
  96.  
  97.  
  98.  
  99. PROC iostyle:(style%)
  100.     LOCAL i%,a%
  101.     i%=0 :REM style option
  102.     a%=style%
  103.     IOW(-2,7,i%,a%)
  104. ENDP
  105.  
  106.  
  107.  
  108. PROC iocurs&:
  109.     LOCAL a%(4),a&
  110.     REM don't change the order of these!
  111.     a%(1)=x1% :a%(2)=y1%
  112.     a%(3)=x2% :a%(4)=y2%
  113.     IOW(-2,8,a%(),a%()) REM 2nd a% is ignored
  114.     RETURN a&
  115. ENDP
  116.  
  117.  
  118.  
  119. PROC iorect:(xx1%,yy1%,xx2%,yy2%)
  120.     LOCAL i%,a%(6)
  121.     i%=2 :REM clear rect option
  122.     a%(1)=xx1% :a%(2)=yy1%
  123.     a%(3)=xx2% :a%(4)=yy2%
  124.     IOW(-2,7,i%,a%())
  125. ENDP
  126.