home *** CD-ROM | disk | FTP | other *** search
- ********************
-
- FUNCTION Mpop
-
- PARAMETERS _top, _left, _down, _over, _file, _fieldlist, _filt, _unique, _shadow, _newcolor, _seekit
-
- * This function is designed to throw a list box to the screen
- * given the first four parameters as screen position, a given
- * file/select area
-
- EXTERNAL Breakout
-
- PRIVATE _ncolor, _okseek, _mpoptop, _mpopleft, _llength, _mpopbot, _mpoprht
- PRIVATE _ccolor, _retarea, _array, _fscr, _bscr, _hbottom, _start
- PRIVATE _preset, _begset, _scrno, _popopt, _dpopt, _opopt, _unistring
- PRIVATE _backitup, _qaz, _promptit, _optpop, _pass_to, _close
-
-
- IF PCOUNT() = 6
- STORE .F. TO _filt, _unique, _shadow, _newcolor
- ELSEIF PCOUNT() = 7
- STORE .F. TO _unique, _shadow, _newcolor
- ELSEIF PCOUNT() = 8
- STORE .F. TO _shadow, _newcolor
- ELSEIF PCOUNT() = 9
- STORE .F. TO _newcolor
- ENDIF
-
- _okseek = IF( (TYPE("_seekit") = "U"), .T., .F.)
- _close = .F.
-
- _mpoptop = _top && The top coordinate
- _mpopleft = _left && The _left coordinate
-
- _llength = (_over-2)
-
- _mpopbot = _top + _down + IF(_shadow, 1, 0)
- _mpoprht = _left + _over + IF(_shadow, 2, 0)
-
- _ccolor = SETCOLOR()
- _retarea = SELECT()
- DECLARE _array[_down]
- SET KEY 18 TO Uppage
- SET KEY 3 TO Downpage
- STORE "" TO _fscr, _bscr
-
- IF (_mpoprht - _mpopleft) < 8 && Handle the Exit Key
- _mpoprht = _mpopleft + 8
- ENDIF
-
- IF _mpopleft+_mpoprht > 78 && Adjust the right/left sides!
- _mpopleft = 78 - _mpoprht
- ENDIF
-
- _bscr = SAVESCREEN( _mpoptop, _mpopleft, _mpopbot, _mpoprht)
-
- IF !EMPTY(_newcolor)
- SETCOLOR(_newcolor)
- ENDIF
-
- Clear_area( _top, _left, _top+_down, _left+_over )
-
- @ _top, _left TO _top+_down, _left+_over DOUBLE
- IF _shadow
- Shadow(_top, _left, _top+_down, _left+_over)
- ENDIF
-
- _fscr = SAVESCREEN(_mpoptop, _mpopleft, _mpopbot, _mpoprht)
-
- IF TYPE("_file") = "C"
- IF LEN(_file) = 1 .OR. ( VAL(_file) >= 1 .AND. VAL(_file) <= 200 )
- SELECT &_file.
- ELSEIF EMPTY(_file)
- * this means that the file is already
- * selected because it is being called with
- * the extended () feature or the Mpop()
- * needs to work in the current and open
- * database
- IF EMPTY(ALIAS())
- RETURN(0)
- ENDIF
- ELSE
- SELECT 0
- USE (_file)
- _close = .T.
- ENDIF
- ELSEIF TYPE("_file") = "N"
- SELECT (_file)
- ELSE
- IF EMPTY(_file)
- * this means that the file is already
- * selected because it is being called with
- * the extended () feature or the Mpop()
- * needs to work in the current and open
- * database
- IF EMPTY(ALIAS())
- RETURN(0)
- ENDIF
- ENDIF
- ENDIF
-
- IF LASTREC() = 0
- SELECT (_retarea)
- SETCOLOR(_ccolor)
- RESTSCREEN(_mpoptop, _mpopleft, _mpopbot, _mpoprht, _bscr)
- RETURN(0)
- ENDIF
-
- IF EMPTY(_filt)
- SET FILTER TO
- ELSE
- _filt = _filt + " .AND. BREAKOUT()"
- IF !(TYPE(_filt) == "U") .OR. !(TYPE(_filt) == "UE")
- SET FILTER TO &_filt.
- ENDIF
- ENDIF
-
- IF _okseek .AND. TYPE("_seekit") != "U"
- IF !EMPTY(_seekit)
- SET SOFTSEEK ON
- SEEK _seekit
- SET SOFTSEEK OFF
- IF !FOUND()
- GO TOP
- ENDIF
- ELSE
- GO TOP
- ENDIF
- ELSE
- GO TOP
- ENDIF
-
- STORE .T. TO _hbottom
- STORE RECNO() TO _start, _preset, _begset, next_set
- STORE 1 TO _scrno, _popopt
- STORE .F. TO down, up
- DO WHILE .T.
- _dpopt = _top + 1
- _opopt = _left + 1
- RESTSCREEN(_mpoptop, _mpopleft, _mpopbot, _mpoprht, _fscr)
- _preset = _begset
- _begset = RECNO()
- _unistring = ""
- _backitup = 0
- FOR _qaz = 1 TO _down-3
- _array[_qaz] = RECNO()
- _promptit = Buildpop(_fieldlist, _over-2)
- IF LEN(_promptit) > _llength
- _promptit = SUBSTR(_promptit, 1, _llength+1)
- ENDIF
- IF _unique
- IF Occurence(_promptit, _unistring) = 0
- @ _dpopt, _opopt PROMPT _promptit
- _dpopt = _dpopt + 1
- _unistring = _unistring + _promptit
- ELSE
- _qaz = _qaz - 1
- ENDIF
- ELSE
- @ _dpopt, _opopt PROMPT _promptit
- _dpopt = _dpopt + 1
- ENDIF
- _backitup = _backitup + 1
- SKIP
- IF EOF()
- _hbottom = .T.
- EXIT
- ELSE
- next_set = RECNO()
- ENDIF
- NEXT
- IF EOF()
- Lastscrn()
- ELSE
- Last_part(IF((_scrno > 1), " PgUp ", "ESC to Exit")) && Not the first screen
- ENDIF
-
- GO _start
- MENU TO _optpop
- DO CASE
- CASE LASTKEY() = 27
- IF up
- up = .F.
- IF _scrno > 1
- _optpop = 1
- _scrno = _scrno - 1
- IF _scrno < 2
- _scrno = 1
- IF _okseek .AND. TYPE("_seekit") != "U"
- IF !EMPTY(_seekit)
- SET SOFTSEEK ON
- SEEK _seekit
- SET SOFTSEEK OFF
- IF !FOUND()
- GO TOP
- ENDIF
- ELSE
- GO TOP
- ENDIF
- ELSE
- GO TOP
- ENDIF
- ELSE
- IF !_hbottom
- GO _begset
- SKIP ((_backitup) * -1)
- ELSE
- GO _preset
- ENDIF
- ENDIF
- ELSE
- RESTSCREEN(_mpoptop, _mpopleft, _mpopbot, _mpoprht, _bscr)
- STORE "" TO _bscr, _fscr
- IF _close
- USE
- ENDIF
- SET KEY 18 TO
- SET KEY 3 TO
- SET FILTER TO
- IF !EMPTY(_file)
- SELECT (_retarea)
- ENDIF
- SETCOLOR(_ccolor)
- RETURN(0)
- ENDIF
- IF _hbottom
- _hbottom = .F.
- ENDIF
- ELSEIF down
- down = .F.
- _optpop = 1
- GO next_set
- _scrno = _scrno + 1
- ELSE
- RESTSCREEN(_mpoptop, _mpopleft, _mpopbot, _mpoprht, _bscr)
- STORE "" TO _bscr, _fscr
- IF _close
- USE
- ENDIF
- SET KEY 18 TO
- SET KEY 3 TO
- SET FILTER TO
- IF !EMPTY(_file)
- SELECT (_retarea)
- ENDIF
- SETCOLOR(_ccolor)
- RETURN(0)
- ENDIF
- OTHERWISE
- DO CASE
- CASE _optpop = _down -1 && Down a page
- CASE _optpop = _down -2
- OTHERWISE
- IF TYPE("_array[_optpop]") = "U"
- _pass_to = 0
- ELSE
- _pass_to = _array[_optpop]
- ENDIF
- RESTSCREEN(_mpoptop, _mpopleft, _mpopbot, _mpoprht, _bscr)
- STORE "" TO _bscr, _fscr
- IF _close
- USE
- ENDIF
- SET KEY 18 TO
- SET KEY 3 TO
- SET FILTER TO
- IF !EMPTY(_file)
- SELECT (_retarea)
- ENDIF
- SETCOLOR(_ccolor)
- RETURN(_pass_to)
- ENDCASE
- ENDCASE
- ENDDO
-
- ********************
-
- FUNCTION Buildpop
-
- PARAMETERS _fieldlist, _thelength
-
- PRIVATE _actfield, _passfield, _buildstr
-
- _actfield = ""
- _passfield= ""
- _buildstr = " "
-
- DO WHILE !EMPTY(_fieldlist)
- _actfield = FIELDNAME(VAL(PARSING(@_fieldlist))) && The name of the field passed by the PARSING function from the passed Fieldlist.
- _passfield = &_actfield. && The acutal contents of the field expressed by ACT_FIELD.
- _buildstr = _buildstr + STRVALUE(_passfield) + " " + CHR(186) + " "
- ENDDO
- _buildstr = SUBSTR(_buildstr, 1, LEN(_buildstr) - 2)
- IF LEN(_buildstr) >= _thelength
- RETURN(SUBSTR(_buildstr, 1, _thelength - 1) + " ")
- ELSE
- RETURN(FILL_OUT(_buildstr, _thelength+1))
- ENDIF
-
- ********************
-
- PROCEDURE Downpage
-
- PARAMETERS p, l, v
-
- KEYBOARD CHR(27)
- down = .T.
-
- ********************
-
- PROCEDURE Uppage
-
- PARAMETERS p, l, v
-
- KEYBOARD CHR(27)
- up = .T.
-
- ********************
-
- PROCEDURE Lastscrn
-
- IF TYPE("_llength") = "U"
- _llength = _over - 2
- ENDIF
-
- IF _scrno > 1
- @ _top + _down + IF( _over <= 10, 1, -2), _left + IF( _over <= 10, 0, 1) SAY " " + Fill_out(" PgUp ", _llength)
- ELSE
- @ _top + _down + IF( (_over <= 10), 1, -2), IF( (_over <=10), _left, _left+1) SAY Fill_out(" ESC to Exit", _llength)
- ENDIF
-
- ********************
-
- PROCEDURE Notlastscr
-
- * This was suddenly removed from the ToolkiT 2.0
-
- ********************
-
- PROCEDURE Last_part
-
- PARAMETER _laststr
-
- IF _over <= 10
- @ _top+_down + 1, _left+1 SAY " " + FILL_OUT(_laststr, _over-2)
- @ _top+_down + 2, _left+1 SAY " " + FILL_OUT(" PgDn ", _over-2)
- ELSE
- @ _top+_down - 2, _left+1 SAY " " + FILL_OUT(_laststr, _over-2)
- @ _top+_down - 1, _left+1 SAY " " + FILL_OUT(" PgDn ", _over-2)
- ENDIF
-
- * End of File
-