SP_TAGMARRAY

TAGMARRAY()

  Short:
  ------
  TAGMARRAY() Tag elements in muti-dimensioned array

  Returns:
  --------
  <aTagged> => an array of numbers representing the
  tagged elements

  Syntax:
  -------
  TAGMARRAY(aArray,[cTitle],[cMark],[aTags],[aHeads])

  Description:
  ------------
  A popup which allows tagging/untagging of elements in
  <aArray>, which is a multi-dimmed array of the format
  {array(n),array(n)} such as is returned by DIRECTORY() or DBSTRUCT().

    SPACE   = Tag/Untag
    F10     = Done
    ESC     = Abort
    ALT-A   = Tag All
    ALT-U   = Untag All
    ALT-S   = Swap Tagged/untagged

  The return value <aTagged> is an array of integer
  values representing the offsets into the original array <aArray> which
  were tagged.

  [cTitle] is a string to be used as the box title

  [cMark]  is the tag character. Default is chr(251) - checkmark

  [aTags]  is an array of logicals the same length as
  <aArray>. This allows pre-tagging. You may also use this
  array on return from the function. The (.T.) elements
  correspond to the tagged elements in <aArray>.

  [aHeads] is an array for the column titles for each
  subarray element in <aArray>, and needs to be the same length
  as a subarray of <aArray>

  Examples:
  ---------
   aDir  := directory()

   aCols := {"File","Size","Date","Time","Attribute"}

   aCopy := tagmarray(aDir,"Select Files for copying",nil,nil,aCols)

   for i = 1 to len(aCopy)

     COPY FILE (aDir[aCopy[i],1 ]) TO (cDestination)

   next

  Notes:
  -------
  Coded by Matthew Maier - thanks.

  Source:
  -------
  S_TAGAM.PRG

 

SP_TAGIT

TAGIT()

  Short:
  ------
  TAGIT() Tag records in a dbf for later action

  Returns:
  --------
  <aTagged> => An array of tagged record numbers

  Syntax:
  -------
  TAGIT(aTagged,[aFields,aFieldDesc],[cTitle])

  Description:
  ------------
  <aTagged> is an array. To start, it is an empty array. It is both
  modified by reference and returned as a parameter. It
  is filled with the record numbers of tagged records. If it is not
  empty when passed in, it is presumed to be filled with already tagged
  record numbers.

  <aTagged> is always 'packed' on entry, so any empty()
  or nil elements are removed, and the length adjusted.

  [aFields,aFieldDesc] are optional arrays of field
  names and field descriptions.

  [cTitle] is an optional title for the tag popup.

  Examples:
  ---------
   aTag := {}
   tagit(aTag,nil,nil,"Tag records to copy")
   copy to temp for (ascan(aTag,recno()) > 0)

  Notes:
  -------
  There are slight differences in behavior from
  previous versions.

  Previous versions required an array of fixed length,
  and only allowed tagging up to that length. This version grows or
  shrinks the array as needed. This version will also shrink an empty
  array down to zero on startup.

  Source:
  -------
  S_TAG.PRG

 

SP_TAGARRAY

TAGARRAY()

  Short:
  ------
  TAGARRAY() Tag selected elements of an array

  Returns:
  --------
  An array containing the element numbers of the tagged
  items

  Syntax:
  -------
  TAGARRAY(aArray,[cTitle],[cMark])

  Description:
  ------------
  Tag items in <aArray>

  Optional title [cTitle] . Optional mark [cMark].

  Default title is none. Default mark is chr(251) - the
  checkmark.

  Examples:
  ---------
   aArr := {1,2,3,4,5,6,7}

   aSel := TAGARRAY(aArr,"Which Items","X")
   for i = 1 to len(aSel)
     DO_SOMETHING_WITH( aArr[ aSel[i] ] )
   next

  Source:
  -------
  S_TAGA.PRG

 

SP_STAGFIELDS

STAGFIELDS()

  Short:
  ------
  STAGFIELDS() Tag fields

  Returns:
  --------
  aTagged => an array of element #'s of the tagged items

  Syntax:
  -------
  STAGFIELDS([aFieldnames],[cTitle],[cMark])

  Description:
  ------------
  Tags selected items in an array of fields, returning
  an array of element #'s of tagged items in the array of fields.

  [aFieldNames] - an array of field names. Default -
  all fields

  [cTitle]      - title for the popup. Default none

  [cMark]       - character used to mark as tagged.

                          Default is checkmark chr(251)

  Examples:
  ---------
   aTagged := STAGFIELDS()

   for i = 1 to len(aTagged)

     ?field(aTagged[i])   // fieldname

   next

  Source:
  -------
  S_TAGF.PRG

 

SP_STABMENU

STABMENU()

  Short:
  ------
  STABMENU() Tabular (grid style) menu

  Returns:
  --------
  <nSelection> => Number of menu option selected

  Syntax:
  -------
  STABMENU(nTop,nLeft,nBottom,nRight,aPrompts,[nStart])

  Description:
  ------------
  Does a tabular (grid) menu based on an array of
  prompts passed as <aPrompts>. Dimensions of the menu table will be
  <nTop,nLeft,nBottom,nRight>. Number of menu rows is
  the number of rows Number of menu columns is determined based on
  number of rows. Prompts are layed out in a snaking fashion :

     e.g. (for a 3 row table...)

       column 1, row 1  = 1st prompt
       column 1, row 2  = 2nd prompt
       column 1, row 3  = 3rd prompt
       column 2, row 1  = 4th prompt

  Pressing a character will move to the next matching
  prompt with that first letter. Left-right and up-down perform a
  snaking pattern

  Pressing ENTER causes selection to be made, and the
  number of the selection to be returned.

  Pressing ESCAPE returns 0.

  [nStart] Optional starting options. Default is 1.

  Examples:
  ---------
   nChoice := ;
          stabmenu(10,10,14,70,{"One","two","three","four",;
                        "five","six","seven","eight",;
                        "nine","ten","eleven","twelve"}, 5)

  Notes:
  -------
  This is a non-popup version of PSTABMENU(), and will
  remain on the screen when done.

  Source:
  -------
  S_TABMEN.PRG

 

SP_SLOTUSMENU

SLOTUSMENU()

  Short:
  ------
  SLOTUSMENU() 1-2-3 style menu

  Returns:
  --------
  <expReturn> => depends on several factors

  Syntax:
  -------
  SLOTUSMENU(nTop,nLeft,nBottom,nRight,aOptions,[lBox],;
        [lSaveRest],[lReset])

  Description:
  ------------
  Draws a 1-2-3 style menu from <nTop>,<nLeft> to
  <nTop+1>,<nRight>.

  <nTop> is the menu option line. <nTop+1> is the
  message line.

  <aOptions> is an array of arrays in the format:

  {  {cOption,cMessage,expAction},
  {cOption,cMessage,expAction},... }

  where <cOption> is the option prompt, <cMessage> is
  the option message, and <expAction> is the option action.

  <expAction> may be of three types:

      1.    a codeblock, in which case it is executed on
            ENTER

      2.    a submenu array of the form:

         {  {cOption,cMessage,expAction},  ;
             {cOption,cMessage,expAction},... }
            which is displayed on ENTER. Pressing ESCAPE
            from the submenu returns to the prior menu.

            The submenu <expaction> may be a codeblock,
            another subarray, or any other value, etc.
            Thus nesting can go as deep as you like.

      3.    any other value, which is returned to the
            calling program on ENTER.

  Pressing ESCAPE from the main menu returns 0

  [lBox]  If True, the menu is drawn inside of a popup
  box. Actual dimensions of the menu area then become
  <nTop>+1,<nLeft>+1 to <nTop>+2,<nRight>-1. Default is False - no box.

  [lSaveRest] If True, the underlying screen is saved
  and restored on entrance/exit. Default is False - no restore.

  [lReset] If True, the menu is reset to first option
  on exit. Default is False - menu remembers where it was.

  SLOTUSCLEAR() resets the menu.

  Examples:
  ---------

   proc test
   local nReturn := 0
   local aMain := {}
   local aSub1 := {{"Pizza",     "Eat Pizza", {||pizza()}},;
                   {"Spaghetti", "Eat Spaghetti", {||spagett()}},;
                   {"Tortellini","Eat Tortellini", {||tortellini()}} }

   local aSub2 := {{"Steak",     "Eat Steak", {||steak()}},;
                   {"Hamburger", "Eat Hamburger",  {||burgers()}},;
                   {"Chili Dog", "Eat Chili Dog",  {||burntwice()}}  }

   aadd(aMain,{"Italian","Eat Italian food",aSub1})
   aadd(aMain,{"American","Eat American food",aSub2})
   aadd(aMain,{"Quit","Just not hungry - Quit",0})
   aadd(aMain,{"Relief","Already ate - need Alka Seltzer",{||alka()} })

   SLOTUSMENU(0,0,0,79,aMain,.t.,.t.,.t.)

   SLOTUSCLEAR()  // !! always use this to clear the menu

  Notes:
  -------

  Always use SLOTUSCLEAR() after calling SLOTUSMENU()

  Source:
  -------
  S_LOTMEN.PRG

 

SP_SGETMANY

SGETMANY()

  Short:
  ------
  SGETMANY()    Virtual (scrolling)  gets in a popup box

  Returns:
  --------
  <lSave> => False if ESC pressed, true otherwise

  Syntax:
  -------
  SGETMANY(aGets,aDesc,nTop,nLeft,nBottom,nRight,[cTitle],[cFoot],[nPadding])

  Description:
  ------------
  READs a series of GETs in a popup box, with the
  ability to scroll the GETs up/down when there are more GETs than fit in
  the box.

  <aGets> is an array of get objects. There are two
  ways to create this:

      1.    Use GETNEW() (the Clipper function) to create each
            individual get object. Get row and column do not
            matter - they will be adjusted.

            GET postblock and preblock (valid and when)
            may be assigned as normal. As each new GET object is created,
            add it to an array.

            Pass this array as <aGets>.

      2.    Use the normal @row,col GET... commands, but to a
            location off the screen - otherwise the gets will DISPLAY
            as you are assigning them.

            @MAXROW()+1,MAXCOL()+1 GET... works for me.

  Using @...GET automatically places new get
  objects in the global array GETLIST. Pass GETLIST as <aGets>.

  <aDesc> this is an array of descriptions for each
  get. (the SAY portion). These will be displayed to the left of
  the get.

  <nTop,nLeft,nBottom,nRight> are the dimensions of the
  popup box. The Editing area will be the inside dimensions of this
  box. Make sure there's room!

  [cTitle] is a string to be used for the title.
  Displayed at <nTop>,<nLeft>+1

  [cFoot] is now ignored. This parameter used to be the footer. It
  is now just a placeholder for downward compatibility.

  [nPadding] is for the number of spaces of padding
  between the box frame and the editing area. The default is 0,
  which places the editing area at
  nTop+1,nLeft+1,nBottom-1,nRight-1. A [nPadding] of 1 would place
  the editing area at nTop+2,nLeft+2,nBottom-2,nRight-2 etc.

  Examples:
  ---------

   local i
   local aDesc := {}
   local aGets
   USE CUSTOMER
   aGets := dbf2array()

   for i = 1 to len(aGets)
     @maxrow()+1,maxcol()+1 get aGets[i]
     aadd(aDesc,field(i))
   next

   SGETMANY(getlist,aDesc,10,10,17,50,;
         "Editing","ESC quits, F10 saves",1)

  NOTES:
  -------
  Do not pass a 0 length string as a GET

  Source:
  -------
  S_GETMANY.PRG

 

SP_SEARCHMRS

SEARCHMRS()

  Short:
  ------
  SEARCHMRS() Resets all SEARCHME() settings

  Returns:
  --------
  NIL

  Syntax:
  -------
  SEARCHMRS([)

  Description:
  ------------
  Resets all SEARCHME() static variables
    - sets found() flag to FALSE
    - sets locate block to nil
    - sets continue flag to .f.
    - sets ALIAS to nil

  For instance, if you change datafiles - you need to reset
  SEARCHME() with SEARMRS()

  Examples:
  ---------
  SEARCHMRS()

  Source:
  -------
  S_SEARCH.PRG

 

SP_SEARCHMFND

SEARCHMFND()

  Short:
  ------
  SEARCHMFND() Set/return last found() status from SEARCHME()

  Returns:
  --------
  <lFound> -> Last searchme found() status

  Syntax:
  -------
  SEARCHMFND([lSet])

  Description:
  ------------
  Sets/retrieves the last found() setting for SEARCHME()
  [lSet] optionally sets the found() flag.

  For instance, to find out what the last result of SEARCHME() was
  so you can take an action or not based on something being found,
  use SEARCHMFND() to retrieve the last result.

  Examples:
  ---------
  SEARCHMFND(.f.)

  Source:
  -------
  S_SEARCH.PRG

 

SP_SEARCHME

SEARCHME()

  Short:
  ------
  SEARCHME() Search a DBF with user-specified criteria

  Returns:
  --------
  <bSearch> -> The code block used to do the search

  Syntax:
  -------
  SEARCHME([aField,aFieldTypes,aFieldLengths],[aFieldDesc])

  Description:
  ------------
  Searches the current dbf with criteria given

  by the user.

       for :    Field Contents Match
                Query match  --->> calls QUERY()
                End of file
                Beginning of File
                Deleted Records
                Memo contents

  On subsequent calls, if the previous search resulted
  in a FOUND(), a box asking "Continue..", "New Search" will pop up.
  If CONTINUE is selected, a continuation of the last search is
  done.

  Three arrays may be passed for FIELDS [aFields],
  FIELD TYPES [aFieldTypes], and FIELD LENGTHS [aFieldLengths].

  An additional (optional) array of field descriptions may be passed

  Default is all fields, field names as descriptions.

  Searchme() actually returns the code block used to do the
  search. Normally you would want to ignore this. I use it in
  TAGIT() - if the code block is not NIL, then I can 'tag all
  matching' with it.

  Examples:
  ---------
  SEARCHME()

  Source:
  -------
  S_SEARCH.PRG