home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a075 / 1.img / TOOLKIT1.EXE / SST236.PRG < prev    next >
Encoding:
Text File  |  1989-08-08  |  2.2 KB  |  84 lines

  1. ********************
  2.  
  3. FUNCTION Prompt
  4.  
  5.    PARAMETERS _options, _sayings, _returns, _confirm, _ancolor
  6.  
  7.    IF PCOUNT() = 0
  8.       _options = "YyNn"
  9.       _sayings = "Yes/Yes/No /No "
  10.       _returns = ".T./.T./.F./.F."
  11.       _confirm = IF( (TYPE("scrconfirm") = "U"), .T., scrconfirm)
  12.       _ancolor = .T.
  13.    ELSEIF PCOUNT() = 1
  14.       IF TYPE("_options") = "L"
  15.          _confirm = _options
  16.          _options = "YyNn"
  17.          _sayings = "Yes/Yes/No /No "
  18.          _returns = ".T./.T./.F./.F."
  19.          _ancolor = .T.
  20.       ELSE
  21.          RETURN(.F.)
  22.       ENDIF
  23.    ELSEIF PCOUNT() = 2
  24.       RETURN(.F.)
  25.    ELSEIF PCOUNT() = 3
  26.       _returns = UPPER(_returns)
  27.       IF EMPTY(STRTRAN(STRTRAN(_returns, "+", ""), "/", "") )      && There are other characters other than a true or a false resposne
  28.          RETURN(.F.)
  29.       ENDIF
  30.       _confirm = IF( (TYPE("scrconfirm") = "U"), .T., scrconfirm)
  31.       _ancolor = .T.
  32.    ELSE
  33.       _ancolor = .T.
  34.    ENDIF
  35.    scrpause = IF( (TYPE("scrpause") = "U"), 100, scrpause)
  36.    scrcolor = IF( (TYPE("scrcolor") = "U"), SETCOLOR(), scrcolor)
  37.  
  38.    PRIVATE _temp, _qaz, _row, _col, _posiion, _wcolor, _inside, _qaz
  39.  
  40.    _temp    = ""
  41.    _temp    = _sayings                        && Put the string over to a 
  42.    DECLARE _sayings[OCCURENCE("/", _temp)+1]  && temp and use the parameter
  43.    FOR _qaz = 1 TO LEN(_sayings)              && as the parameter as the new
  44.       _sayings[_qaz] = PARSING(@_temp)        && array of messages...
  45.    NEXT
  46.    _row = ROW()
  47.    _col = COL()
  48.    _position = 0
  49.    _wcolor = SETCOLOR()
  50.    IF _ancolor
  51.       SETCOLOR(SET_COLOR(ATTRIBUTE(_row, _col+1)))
  52.    ENDIF
  53.  
  54.    DO WHILE .T.
  55.       _inside = CHR(INKEY(0))
  56.  
  57.       IF _confirm .AND. LASTKEY() = 13
  58.          IF _position != 0
  59.             EXIT
  60.          ENDIF
  61.       ELSE
  62.          IF _inside$_options
  63.             _position = AT(_inside, _options)
  64.             @ _row, _col SAY _sayings[_position]
  65.             IF !_confirm
  66.                EXIT
  67.             ENDIF
  68.          ENDIF
  69.       ENDIF
  70.  
  71.    ENDDO
  72.  
  73.    FOR _qaz = 1 TO scrpause
  74.    NEXT
  75.  
  76.    SETCOLOR(_wcolor)
  77.    FOR _qaz = 1 TO _position
  78.       _temp = PARSING(@_returns)
  79.    NEXT
  80.    
  81.    RETURN(&_temp.)
  82.  
  83. * End of File
  84.