SP_PSTABMENU

PSTABMENU()

  Short:
  ------
  PSTABMENU() Popup tabular (grid style) )menu

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

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

  Description:
  ------------
  Pops up a tabular (grid) menu based on an array of
  prompts passed

  as <aPrompts>. Dimensions of the menu table will be
  inside of the <nTop,nLeft,nBottom,nRight> dimensions for the popup
  box. Number of menu rows is the number of rows inside the box.
  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.

  [cTitle]  is a itle for the popup box

  [nStart]  is an optional starting option. Default is 1.

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

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

 

SP_POPUPWHEN

POPUPWHEN()

  Short:
  ------
  POPUPWHEN() Allows use of a popup for a GET WHEN clause

  Returns:
  --------
  <lWhen> => when condition, get pre-validation

  Syntax:
  -------
  POPUPWHEN(bPopup,[lShowonUp],[lReturn])

  Description:
  ------------
  This sets up a popup in <bPopup> for use in a GET
  WHEN clause. (the pre validation block). If a value is returned
  from the popup, it is assigned to the get.

  <bPopup> is a codeblock that is evaluated. It is
  passed the current value in the get as a parameter.

  The popup function will pop up upon entry into a GET
  field.

  [lShowOnUp] Normally you wouldn't want this WHEN to
  occur if the user is using the up arrow, and if <lShowOnUp> is
  .f. (the default) it does not occur (the GET is just skipped)

  [lReturn] If set to False (the default) the GET is
  never actually edited, as the WHEN will always return .f., but it is
  assigned the value returned by the popup. By setting it to True,
  the Calendar will pop up, and then the GET will also be put
  through the normal get editor.

  Examples:
  ---------
   // these are codeblocks that do a popup (in this case, a  simple
   //call to msg, and a return of a value)

   b1 := {||msg("Character value"),"Bert"}
   b2 := {||msg("Logical value"),.t.}
   b3 := {||msg("Date value"),date()+100}

   v1 := space(10)
   v2 := .f.
   v3 := ctod("  /  /  ")

   @10,10 get v1 when POPUPWHEN(b1,.f.,.t.)
   @11,10 get v2 when POPUPWHEN(b2,.f.,.t.)
   @12,10 get v3 when POPUPWHEN(b3,.f.,.t.)

   READ

  Source:
  -------
  S_POPVW.PRG

 

 

SP_POPUPVALID

POPUPVALID()

  Short:
  ------
  POPUPVALID() Allows use of a popup for a GET VALID clause

  Returns:
  --------
  <lValid> => valid condition, get post-validation

  Syntax:
  -------
  POPUPVALID(bPopup,[bValid])

  Description:
  ------------
  This sets up a popup in <bPopup> for use in a GET
  VALID clause. (the post validation block). If a value is returned
  from the popup, it is assigned to the get.The popup function will pop
  up upon exit from the GET field.

  <bPopup> is a codeblock that is evaluated. It is
  passed the current value in the get as a parameter.

  [bValid]  - If you pass a validation codeblock, it
  will be checked first. If the GET is already valid, according to
  the codeblock, the popup will not be popped up. The codeblock
  must return a logical value.

  Examples:
  ---------

   // these are codeblocks that do a popup (in this case, a  simple
   //call to msg, and a return of a value)

   b1 := {||msg("Character value"),"Bert"}
   b2 := {||msg("Logical value"),.t.}
   b3 := {||msg("Date value"),date()+100}
   b4 := {||msg("Number value"),123}

   v1 := space(10)
   v2 := .f.
   v3 := ctod("  /  /  ")
   v4 := 0

   // these are added in as valid clauses to the gets. The <bValid>
   // param is a codeblock that checks for the value being empty.

   @14,10 get v1 valid POPUPVALID(b1,{||!empty(v1)})
   @15,10 get v2 valid POPUPVALID(b2,{||!empty(v2)})
   @16,10 get v3 valid POPUPVALID(b3,{||!empty(v3)})
   @17,10 get v4 valid POPUPVALID(b4,{||!empty(v4)})

   read

  Source:
  -------
  S_POPVW.PRG

SP_POPUPKSET

POPUPKSET()

  Short:
  ------
  POPUPKSET() Set a popup for hotkey access from a GET

  Returns:
  --------
  Nil

  Syntax:
  -------
  POPUPKSET(nKey,cProc,cVar,bPopup)

  Description:
  ------------
  When key <nKey> is pressed while in proc or function
  <cProc> and in get/variable <cVar>, the block <bPopup> will be
  evaluated.

  If <bPopup> returns a value, it will be assigned to
  the current get.

  Be sure to clear popups with POPUPKCLR() after the
  READ.

  Examples:
  ---------
   #include "inkey.ch"

   proc test
   b1 := {||msg("Character value"),"Bert"}
   b2 := {||msg("Logical value"),.t.}
   b3 := {||msg("Date value"),date()+100}
   b4 := {||msg("Number value"),123}

   v1 := space(10)
   v2 := .f.
   v3 := ctod("  /  /  ")
   v4 := 0

   POPUPKSET(K_F1,"TEST","V1",b1)
   POPUPKSET(K_F2,"TEST","V2",b2)
   POPUPKSET(K_F3,"TEST","V3",b3)
   POPUPKSET(K_F4,"TEST","V4",b4)

   @14,10 get v1      // if F1 is pressed here, b1 will be evaluated
   @15,10 get v2      // if F2 is pressed here, b2 will be evaluated
   @16,10 get v3      // if F3 is pressed here, b3 will be evaluated
   @17,10 get v4      // if F4 is pressed here, b4 will be evaluated

   read

   POPUPKCLR()

  Source:
  -------
  S_POPUPK.PRG

 

 

SP_MFIELDS

MFIELDS()

  Short:
  ------
  MFIELDS() Pops up a selection box for current dbf fields

  Returns:
  --------
  <cFieldName> => field name or "" if none selected

  Syntax:
  -------
  Mfields([cTitle],[nTop,nLeft,nBottom,nRight])

  Description:
  ------------
  Popus up a box and presents an selection menu for the
  current dbf fields.

  [cTitle] is a title for the box.

  [nTop...nRight]  are coordinates of the box. Default
  is centered.

  Examples:
  ---------
   cFieldname := MFIELDS()

   // *or

   cFieldname := MFIELDS("Pick a Field")

   //*or

   cFieldname := MFIELDS('Pick a Field',10,10,20,40)

  Source:
  -------
  S_MFLD.PRG

 

SP_MESSYN

MESSYN()

  Short:
  ------
  MESSYN() Popup YesNo prompt box

  Returns:
  --------
  <lYes> => True for yes, False for No

  Syntax:
  -------
  MESSYN(cQuestion,[cYes],[cNo],[nTop],[nLeft])

  Description:
  ------------
  Pops up a box and displays a question <cQuestion>
  and two prompts.

  [cYes] ,[cNo] are optional prompts 1 and 2. Default
  is YES/NO.

  [nTop] and [nLeft] are optional box top and left
  coordinates. Default is centered.

  Examples:
  ---------
   if messyn("Are you done")

   if messyn("Are you done","Not yet","Almost",10,10)

   if messyn("Are you done","Not Yet","Almost")

  Source:
  -------
  S_MESSYN.PRG

 

SP_MENU_V

MENU_V()

  Short:
  ------
  MENU_V() Vertical popup menu from variable # parameters

  Returns:
  --------
  <nSelection> => selection - 0 for no selection

  Syntax:
  -------
  MENU_V(cTitle,cOption1,[cOption2,...cOption16])

  Description:
  ------------
  Creates a popup vertical menu in a centered box,
  using <cTitle> as the title, and performing a menu to on
  <cOption1...cOption16> (variable #)

  <cTitle> may be passed as "" for no title.

  [cOption2..cOption16] are optional

  Examples:
  ---------
   nChoice :=  menu_v("Selection","Edit","Add","Quit")

       -or-

   nChoice :=  menu_v("","Edit","Add","Quit")

  Source:
  -------
  S_MENUV.PRG

 

SP_MCHOICE

MCHOICE()

  Short:
  ------
  MCHOICE() Does a boxed, achoice() style popup on an array

  Returns:
  --------
  <expN> Achoice selection

  Syntax:
  -------
  MCHOICE(aOptions,[nTop,nLeft],[nBottom,nRight],[cTitle],[lTrigger],;
                   [nStart],[@nRow],[aSelectable])

  Description:
  ------------
  Provides a box for selection from array <aOptions> of
  character elements.

  [nTop,nLeft] may be specifed to determine the
  starting top and left of the popup box.

  [nBottom,nRight] may be specified to complete the box
  dimensions.

  Default box dimensions are centered on the screen. If the dimensions
  passed are not wide enough to display the mouse hot areas on the
  bottom, the box is widened and centered on the screen.

  [cTitle] is a string to display at the top of the box.

  [lTrigger] determines (yes or no) whether a return is
  to be executed on a first letter match.(default .f.)

  [nStart] optional starting element (default 1)
  [@nRow] optional starting row. Pass by reference to retain value
  between calls.

  [aSelectable] is an array of logicals that determines which items
  are selectable. This array must be the same size as [aOptions], and
  all elements must be either True or False, not NIL. Where an element
  is False, the corresponding element in [aOptions] will be dimmed
  and will emit a BEEP when you attempt to select it.

  Examples:
  ---------
   aMeals   := {"Pizza","Chicken","Chinese"}
   nSelect  := mchoice(aMeals)

   // or box with title
   aMeals   := {"Pizza","Chicken","Chinese"}
   nSelect  := mchoice(aMeals,,,,"Meals")

   // or box with title, first letter match = return and top/left specified
   aMeals   := {"Pizza","Chicken","Chinese"}
   nSelect  := mchoice(aMeals,10,10,,,"Meals",.t.)

   //to retain element and position between calls
   nSelect := 1
   nRow    := 1
   aMeals   := {"Pizza","Chicken","Chinese"}
   while nSelect > 0
     nSelect  := mchoice(aMeals,,,,,"Meals",.t.,nSelect,@nRow)
     // code
   endif

  Notes:
  -------
  Bottom of window adjusts (shrinks) to adjust to array
  size if needed.

  Now uses Tbrowse() instead of ACHOICE().

  Source:
  -------
  S_MCHOI.PRG

 

SP_HELPMOD

HELPMOD()

  Short:
  ------
  HELPMOD() Interactively build and modify help screens

  Returns:
  --------
  Nothing

  Syntax:
  -------
  SET KEY xxx TO HELPMOD

  Description:
  ------------
  HELPMOD() creates and modifies help screens for
  HELP() which are stored in HELP.DBF.

  HELPMOD() allows online creation and modification of
  the size, location and contents of the help screen for the
  current PROC,VARIABLE combination, and stores the results in
  HELP.DBF.

  HELPMOD() is intended to be used online, during
  program execution, by the developer/programmer. It can be
  removed after development.

  By setting a key xxx to this function, the current
  PROC and VARIABLE are passed to it when the key is pressed
  during the program.

  By comparing the PROC and VARIABLE parameters against
  entries in the HELP.DBF, HELPMOD() can then provide the
  appropriate help screen for modification, or, if no matching
  record is found, allow creation of a new help screen record.

  HELP.DBF is created if not present.

  Examples:
  ---------
   EXTERNAL HELPMOD

   SET KEY -30 TO HELPMOD  && alt-F1

  Notes:
  -------
  Will not be much use during ACHOICE or MENU TO

  Source:
  -------
  S_HELPM.PRG