SP_SMALLWHEN

SMALLWHEN()

  Short:
  ------
  SMALLWHEN() Uses SMALLS() in a WHEN condition for a GET

  Returns:
  --------
  lValid  => logical value

  Syntax:
  -------
  SMALLWHEN([lShowOnUp],[lReturn],expDisplayString,[cTitle],;
       [expAlias],expReturn,[expStartRange,expEndRange],[bException])

  Description:
  ------------
  Uses SMALLS() in a WHEN condition for a GET. See
  SMALLS() for description of parameters <expDisplayString>
  through [bException]

  [lShowOnUp] If False (the default), smalls is not
  called when going backwards through the read (up arrow, etc), only when
  going forward.

  [lReturn]   This is simply the value to return. The
  default is False, which means the get is never 'edited'. A value
  of True means the smalls() lookup is done, and then the get is edited.

  Examples:
  ---------
   @3,0 GET V3 WHEN ;
       SMALLWHEN(.f.,.f.,"LASTNAME",nil,5,"LASTNAME")

   // This will pop up a smalls() lookup table when going forward
   // through the gets. If RETURN is pressed, the current GET is fed
   // or assigned the lookup value. (depends on value of <expReturn>)
   // A False is returned, so the GET is not actually edited. The new
   // value is displayed, and the next get is made active.

  Notes:
  -------
  See Smalls() for a complete parameter description.

  Source:
  -------
  S_SMGETS.PRG

 

SP_SMALLVALID

SMALLVALID()

  Short:
  ------
  SMALLVALID() Uses SMALLS() lookups in a VALID condition for a GET

  Returns:
  --------
  lValid  => logical value

  Syntax:
  -------
  SMALLVALID([bValid],expDisplayString,[cTitle],;
     [expAlias],expReturn,[expStartRange,expEndRange],[bException])

  Description:
  ------------
  Uses SMALLS() in a VALID condition for a GET. See
  SMALLS() for description of parameters <expDisplayString>
  through [bException]

  If the user selects a value from the SMALLS() lookup,
  a value of True is returned, allowing the next GET to be made
  active. Otherwise, a False is returned. The return value is also
  determined by [bValid]

  [bValid]  -  This is a code block that determines if
  the current get is already valid. If this is passed, it is first
  evaluated, and, only if the current get is NOT ALREADY VALID,
  SMALLS() is called with the SMALLS() parameters given. If this
  is not passed, SMALLS() is called automatically. IF this is
  passed and the GET is valid, a True is returned, allowing the
  next GET to be 'gotten'.

  Examples:
  ---------
   @3,0 GET V3 VALID  ;
       SMALLVALID({||!EMPTY(V3)},"LASTNAME",nil,5,"LASTNAME")

   // This will pop up a smalls() lookup table when attempting to exit
   // the get 'V3' where 'V3' is empty. A SMALLS() lookup is  called, with
   // smalls() parameters provided, and, if CR is pressed, the GET is fed
   // or assigned the lookup value. (depends on value of <expReturn>)
   // If 'V3' is already valid, a True is returned, and the next GET is made
   // active. If SMALLS() is called and CR is pressed while in SMALLS(),
   // a True is returned. Otherwise a False is returned.

  Notes:
  -------
  See Smalls() for a complete parameter description.

  Source:
  -------
  S_SMGETS.PRG

SP_SMALLS

SMALLS()

  Short:
  ------
  SMALLS() Lookup tables on dbf with optional hotkeys, code block

  Returns:
  --------
  lReturn   => True if CR pressed, False otherwise

  Syntax:
  -------
  Smalls(expDisplayString,[cTitle],[expAlias],[expReturn],;
      [expStartRange,expEndRange],[bException],[lForceCaps])

  Description:
  ------------
  Popup windowed lookup tables. Many options.

  The up/down/home/end/pgup/pgdn keys are active. If
  there is an controlling index key and the user types alphanumeric
  characters, it is assumed a keysearch is wanted. A read pops up
  allowing the user to complete the search key, and a seek is then
  done.

  Pressing ENTER or ESCAPE exits the lookup and closes
  the window.

  Depending on values contained in the optional
  parameters, values may be KEYBOARDED or ASSIGNED at that time.

  Other keys may be assigned actions, depending on the
  last parameter, described below.

  <expDisplayString>  is what appears for each row in
     the lookup table.

     Think of it as a column definition for Tbrowse.
       It can be either:

       1. A Characters string like
          "LAST+MI+LEFT(FIRST,1)"
          In which case it is macro expanded and made
          into a code block to display this expression

       2. A Codeblock like
          {||LAST+MI+LEFT(FIRST,1)}

       The resulting codeblock is then used as a
       Tbrowse column definition.

  [cTitle]    is an optional lookup box title string

  [expAlias]  Determines the area/dbf/ntx to use, can be
     (expC) alias name             or
     (expN) numeric work area      or
     (expC) dbf/ndx in the format
            "%dbfname%ndxname"

     If left as nil, the current DBF/NTX are
     used and left open when done at the last record
     pointer position.

  [expReturn] This determines what happens when CR is
     pressed. It need not be anything, but it can be:

     (expC) a character expression which is
            macro expanded and KEYBOARDed. Any valid character
            expression will do.

            (Bear in mind that it must be
              character. If you want to keyboard a value into a DATE
              field, for instance, your keyboard expression could be
              "DTOC(entrydate)"

     (expB) a code block which is simply
            evaluated. this can do
            anything you wish. It could assign
            multiple values
            from the lookup file into active
            gets, for instance.

  [expStartRange-expEndRange]
     These are valid for indexed files, and
     determine the beginning and ending key ranges. The
     values must match the type of the controlling index.

  [bException]
     If this codeblock is passed, any keys
     except up/down/enter/pgup/pgdn/home/end/escape  (and
     alphanumeric keys if indexed )  will cause the block to be
     evaluated like so:

       eval(block,lastkey())

     Some interesting ideas for this would be
     to assign a key to an update routine for updating the
     lookup dbf while doing a lookup. (yikes - you didn't hear
     that from me!)

  [lForceCaps]

     Means force capital letters when user is typing in a
     lookup key.  Allows case-insensitive search when index is on
     upper(field)

  Examples:
  ---------
   // lookup on "LNAME+' '+FNAME" in current area
   smalls("LNAME+' '+FNAME")

   // lookup on "LNAME+' '+FNAME" in current area
   // use "Name" as box title
   smalls("LNAME+' '+FNAME","Name")

   // lookup on "LNAME+' '+FNAME" in current area
   // use "Name" as box title
   // go to area 5 for the lookup
   // send LNAME to the keyboard if CR pressed
   smalls({||LNAME+''+FNAME},"Name",5,"LNAME")

   // lookup on "LNAME+' '+FNAME" in current area
   // use "Name" as box title
   // go to alias CUSTOMER for the lookup
   smalls("LNAME+''+FNAME","Name","CUSTOMER")

   // open customer.dbf and do a lookup on it
   // lookup on "LNAME+' '+FNAME"
   // use "Name" as box title
   smalls("LNAME+''+FNAME","Name","%CUSTOMER")

   // open customer.dbf and do a lookup on it
   // lookup on "LNAME+' '+FNAME"
   // use "Name" as box title
   // limit lookup to between "SMITH" and "ZEBRA"
   smalls("LNAME+''+FNAME","Name","%CUSTOMER%NAME",  ;
         "SMITH","ZEBRA")

   // open CUSTOMER.DBF with ENTRYDATE.NDX and do a lookup
   // lookup on "LNAME+' '+FNAME"
   // use "Name" as box title
   // limit lookup to the last year
   smalls("LNAME+''+FNAME","Name",  ;
         "%CUSTOMER%ENTRYDATE",date()365, date())

  Notes:
  -------
  see SMALLVALID(), SMALLWHEN() and SMALLKSET() for
  various get system interfaces to SMALLS().

  Source:
  -------
  S_SMAL.PRG

 

SP_SCROLLER

SCROLLER()

  Short:
  ------
  SCROLLER() Hotkey lookup tables with dbf storage

  Returns:
  --------
  nothing

  Syntax:
  -------
  SET KEY xxx TO SCROLLER

  Description:
  ------------
  Scroller is a hotkey lookup table engine.

  Scroller is data-driven , meaning it operates on data
  stored external to

  the EXE in SCROLLER.DBF.

  SCROLLER() is called via a SET KEY. When called, it
  receives the parameters <cProc> and <cVar> from Clipper, telling
  it the proc and variable the user was sitting on when he pressed
  the hotkey.

  The actual parameters rec'd are <cProc> (proc name),
  <cLine> (line #) and <cVar> (variable name) .<cLine> is ignored,
  but it is included as the 2nd parameter because it is passed by
  Clipper's setkey routines.

  SCROLLER() attempts to find a corresponding record in
  SCROLLER.DBF (which contains fields for proc name and variable).
  SCROLLER.DBF is a storage place for lookup definitions.

  If SCROLLER does not find a matching record, it
  simply closes SCROLLER.DBF and returns to the previous area. It
  then displays a 'lookup table not found' message.

  If SCROLLER finds a matching record, it loads the
  values into memory and closes SCROLLER.DBF. It then opens the
  DBF [and index] of the lookup dbf in the next available area. If
  it is unable to open the dbf, it displays an error message and
  goes back to the previously selected area.

  SCROLLER then draws a box, using the DESCRIPTION
  field as the title, initializes a 1 element array composed of
  the SSTRING (see structure)  expression and calls SMALLS() .

  While in the SMALLS(), first letter searches can be
  done if the dbf is indexed  with a character index. Pressing
  ENTER will KEYBOARD the expression in SRETURN (unless its
  empty), close up the current area and return to the old area.
  Pressing escape just closes things up and returns to the old
  area.

  The KEYBOARD then takes over, feeding the SRETURN
  expression into the keyboard and into the current GET or GETS.

  Examples:
  ---------
   EXTERNAL SCROLLER

   SET KEY -1 TO SCROLLER  && F2

  Notes:
  -------
  BIG NOTE:

  This is really for managing dynamic lookup tables
  that will change frequently as to lookup params. Because of this, it
  is quite complex in nature.

  If you know what the lookup is going to be, and it
  will not change between compiles, look at SMALLS(), SMALLKSET(),
  SMALLVALID() and SMALLWHEN() and use one of these as
  appropriate, instead of SCROLLER().

  Source:
  -------
  S_SCROLL.PRG