home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / utilsf / hypoc2 / BROWSE.OPL < prev    next >
Text File  |  1994-07-06  |  3KB  |  84 lines

  1. app hyperpoc
  2. enda
  3. rem ---------------------------------
  4. proc browse%:(par$)
  5. rem ---------------------------------
  6. rem
  7. rem  browse% displays all cards of the specified stack.
  8. rem  Pressing ESC or a hot key will abort browse.
  9. rem  Any other key will stop at the current card displayed.
  10. rem  par$ indicates the stack to be used:
  11. rem    "c" for the current stack
  12. rem    other for stack selection via dialog box
  13.  
  14. rem handles for card
  15. global cdHand&,cardnum%,stack$(128)
  16. rem variables
  17. local r%,c%,oldStk$(128),oldCd%
  18. rem remember current card
  19.         oldStk$ = curStk$
  20.         oldCd% = cuCd%
  21.         r% = -1
  22.         stack$ = curStk$
  23.         if par$ <> "c"
  24. rem ask stackname with current stack as default
  25.                 stack$ = curStk$
  26.                 lock on
  27.                 dinit tx$:(165) : rem "Browse"
  28.                 dfile stack$,tx$:(129),16
  29.                 r% = dialog
  30.                 lock off
  31.         endif
  32.         if r%
  33.                 onerr err1 : rem     Define error handler
  34. rem     The browsing is actually implemented as onIdle: routine
  35. rem     We simply ask for a key press while switching
  36. rem     animation(1) and music(2) off but enabling the onIdle: routine(8).
  37.                 c% = getKey%:(11)
  38. rem     Return to HyperPoc displaying the old card
  39.                 if c% = 27 or c% >= 512
  40.                         showCd%:(oldStk$,oldCd%)
  41.                 endif
  42. bye::
  43.                 busy off
  44.                 warning:(tx$:(166),0) : rem "Browsing finished"
  45.                 return c%
  46. rem
  47. rem     Error handler : Return error code to hyperpoc
  48. rem
  49. err1::
  50.                 onerr off
  51.                 return err
  52.         endif
  53. endp
  54.  
  55. rem onIdle: searchs for the next card and displays it.
  56. rem The routine is called continously. When no more
  57. rem cards are found, onIdle returns the code for the
  58. rem ESC key which is then returned via getKey%:.
  59.  
  60. proc onIdle:
  61.         busy tx$:(167) : rem "Browsing"
  62.         cardnum% = findCd%:(stack$,1,"",addr(cdHand&))
  63.         if cardnum% = 0 : return 27 : endif
  64.         showCd%:(stack$,cardnum%)
  65. endp
  66.  
  67. rem edParm$: supports the editing process for browse objects.
  68.  
  69. proc edParm$:(parm$)
  70. local p%
  71.         if parm$ = "c"
  72.                 p% = 1
  73.         else
  74.                 p% = 2
  75.         endif
  76.         dinit tx$:(165) : rem "Browse"
  77.         dchoice p%,tx$:(129),tx$:(168) : rem "Stack" "current,as selected"
  78.         dialog
  79.         if p% = 1
  80.                 return "c"
  81.         endif
  82. endp
  83.  
  84.