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

  1. ********************
  2.  
  3. FUNCTION Atsayget
  4.  
  5.    PARAMETERS _row, _col, _say, _get, _pict, _valid, _withread
  6.  
  7.    PRIVATE _wcolor
  8.    _wcolor = SETCOLOR()
  9.  
  10.    IF PCOUNT() = 1
  11.       IF TYPE("_row") = "L"
  12.          scrcursor = .T.
  13.          SET CURSOR ON
  14.          IF _row
  15.             READ
  16.          ELSE
  17.             CLEAR GETS
  18.          ENDIF
  19.          SET CURSOR OFF
  20.          RETURN( IF( (LASTKEY() = 27), .F., UPDATED() ) )
  21.       ENDIF
  22.    ENDIF
  23.  
  24.    IF TYPE("_row") = "L"
  25.       IF TYPE("_col") != "U"
  26.          _row = _col
  27.       ENDIF
  28.       IF TYPE("_say") != "U"
  29.          _col = _say
  30.          _say = ""
  31.       ENDIF
  32.       IF TYPE("_get") != "U"
  33.          _say = _get
  34.          _get = ""
  35.       ENDIF
  36.       IF TYPE("_pict") != "U"
  37.          _get = _pict
  38.          _pict = ""
  39.       ENDIF
  40.       IF TYPE("_valid") != "U"
  41.          _pict = _valid
  42.          _valid = ".T."
  43.       ENDIF
  44.       IF TYPE("_withread") != "U"
  45.          _valid = _withread
  46.       ELSE
  47.          _valid = ".T."
  48.       ENDIF
  49.       _withread = .T.
  50.    ELSE
  51.       _withread = .F.
  52.       IF TYPE("_valid") != "U"
  53.          IF EMPTY(_valid)
  54.             _valid = ".T."
  55.          ENDIF
  56.       ENDIF
  57.       IF TYPE("_get") != "U"
  58.          IF EMPTY(_get)
  59.             RELEASE _get
  60.          ENDIF
  61.       ENDIF
  62.  
  63.       IF TYPE("_pict") != "U"
  64.          IF EMPTY(_pict)
  65.             RELEASE _pict
  66.          ENDIF
  67.       ENDIF
  68.  
  69.       IF TYPE("_say") != "U"
  70.          IF EMPTY(_say)
  71.             RELEASE _say
  72.          ENDIF
  73.       ENDIF
  74.  
  75.  
  76.    ENDIF
  77.  
  78.    SETCOLOR(Set_color(Attribute(_row, _col+1)))
  79.  
  80.    IF PCOUNT() < 2
  81.       SETCOLOR(_wcolor)
  82.       RETURN(.F.)
  83.    ELSEIF PCOUNT() = 2
  84.       IF TYPE("_row")+TYPE("_col") != "NN"
  85.          SETCOLOR(_wcolor)
  86.          RETURN(.F.)
  87.       ELSE
  88.          @ _row, _col
  89.       ENDIF
  90.    ENDIF
  91.    
  92.    IF TYPE("_pict") != "U"
  93.       IF !("@"$_pict) .AND. TYPE(_get) = "C"          && if no at sign in picture and data type of 
  94.          *                                               the GET is of character type, then...
  95.    
  96.          _difference = ( LEN(Strvalue(_say)) + IF( (TYPE("_pict") = "U" ), ;
  97.                        LEN(Strvalue(_get)), LEN(_pict) ) + 2 ) - 80
  98.          
  99.          * If empty(difference), o.k. or if difference is
  100.          * a negative number, it's o.k. too.  But is positive
  101.          * take the number, LTRIM(STR()) it and add and "@" to
  102.          * the pict of the GET so that it will fit in the
  103.          * window area...
  104.  
  105.          IF _difference > 0
  106.             _pict = "@S" + LTRIM(STR(_difference)) + IF( (TYPE("_pict") = "U" ), LEN(Strvalue(_get)), LEN(_pict) )
  107.          ENDIF
  108.       ENDIF
  109.    ELSE
  110.       IF TYPE("_get") != "U"
  111.          IF TYPE(_get) = "C"
  112.             _difference = ( LEN(Strvalue(_say)) + IF( (TYPE("_pict") = "U" ), ;
  113.                           LEN(Strvalue(_get)), LEN(_pict) ) + 2 ) - 80
  114.             
  115.             * If empty(difference), o.k. or if difference is
  116.             * a negative number, it's o.k. too.  But is positive
  117.             * take the number, LTRIM(STR()) it and add and "@" to
  118.             * the pict of the GET so that it will fit in the
  119.             * window area...
  120.   
  121.             IF _difference > 0
  122.                _pict = "@S" + LTRIM(STR(_difference)) + IF( (TYPE("_pict") = "U" ), LEN(Strvalue(_get)), LEN(_pict) )
  123.             ENDIF
  124.          ENDIF
  125.       ENDIF
  126.    ENDIF
  127.  
  128.    IF TYPE("_pict") = "U"
  129.       IF TYPE("_get") != "U"
  130.          IF TYPE(_get) = "D"
  131.             _pict = "99/99/99"
  132.          ELSEIF TYPE(_get) = "M"
  133.             _pict = "@S10"
  134.          ELSEIF TYPE(_get) = "L"
  135.             _pict = "@!"
  136.          ENDIF
  137.       ENDIF
  138.    ENDIF
  139.  
  140.    IF TYPE("_get") = "U"
  141.       @ _row, _col SAY _say
  142.  
  143.    ELSEIF TYPE("_get") != "U" .AND. TYPE("_valid") = "U"
  144.  
  145.       IF EMPTY(_say)                                               && No Say
  146.          IF TYPE("_pict") != "U"                                   && With Picture
  147.             IF TYPE("_get") = "U"
  148.             ELSE
  149.                @ _row, _col GET &_get. PICT _pict
  150.             ENDIF
  151.          ELSE                                                      && Without Picture
  152.             IF TYPE("_get") = "U"
  153.             ELSE
  154.                @ _row, _col GET &_get.
  155.             ENDIF
  156.          ENDIF
  157.       ELSE                                                         && With SAY
  158.          IF TYPE("_pict") != "U"                                   && With Picture
  159.             IF EMPTY(_get)
  160.                @ _row, _col SAY _say PICT _pict
  161.             ELSE
  162.                IF TYPE("_get") = "U"
  163.                   @ _row, _col SAY _say 
  164.                ELSE
  165.                   @ _row, _col SAY _say GET &_get. PICT _pict
  166.                ENDIF
  167.             ENDIF
  168.          ELSE                                                      && Without Picture
  169.             IF EMPTY(_get)
  170.                @ _row, _col SAY _say
  171.             ELSE
  172.                IF TYPE("_get") = "U"
  173.                   @ _row, _col SAY _say
  174.                ELSE
  175.                   @ _row, _col SAY _say GET &_get.
  176.                ENDIF
  177.             ENDIF
  178.          ENDIF
  179.       ENDIF
  180.  
  181.    ELSEIF TYPE("_valid") != "U"
  182.       IF EMPTY(_say)
  183.          IF TYPE("_get") = "U"
  184.          ELSE
  185.             @ _row, _col GET &_get. PICT _pict VALID &_valid.
  186.          ENDIF
  187.       ELSE
  188.          IF TYPE("_get") = "U"
  189.             IF TYPE("_pict") = "U"
  190.                @ _row, _col SAY _say
  191.             ELSE
  192.                @ _row, _col SAY _say PICT _pict
  193.             ENDIF
  194.          ELSE
  195.             IF TYPE("_pict") = "U"
  196.                @ _row, _col SAY _say GET &_get. VALID &_valid.
  197.             ELSE
  198.                @ _row, _col SAY _say GET &_get. PICT _pict VALID &_valid.
  199.             ENDIF
  200.          ENDIF
  201.       ENDIF
  202.    ENDIF
  203.  
  204.    IF _withread
  205.       scrcursor = .T.
  206.       SET CURSOR ON
  207.       READ
  208.       SET CURSOR OFF
  209.       scrcursor = .F.
  210.       SETCOLOR(_wcolor)
  211.       RETURN( IF( (LASTKEY() = 27), .F., UPDATED() ) )
  212.    ELSE
  213.       SETCOLOR(_wcolor)
  214.       RETURN(.T.)
  215.    ENDIF
  216.  
  217. * End of File
  218.