home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / CLIPPER / SCRNUZ / BLIST.PRG < prev    next >
Text File  |  1990-02-25  |  4KB  |  108 lines

  1. * Program Name: blist.prg 
  2. * Author: Ed Phillips 
  3. * Copyright (c) 1990 by EDON Corporation 
  4. *-----------------------------------------------------------------------------
  5. * Created: 2/24/1990 at 9:54
  6. * main = 
  7. * Called From:
  8. * --- Data Base Files ---   ----- Index Files -----   ----- Other Files ---- 
  9. *
  10. *
  11. *
  12. *.............................................................................
  13. * Revision: 1.0 Last Revised: 2/24/1990 at 9:54
  14. * Description: Routine to build and pick from a list.
  15. *.............................................................................
  16. *---------------------------- ALL RIGHTS RESERVED ----------------------------
  17.  
  18. *** Syntax: DO Blist WITH switch
  19.  
  20.  
  21. PARA switch
  22.  
  23.  
  24. *---------------------------
  25. *   declare local variables
  26. *---------------------------
  27. PRIV oldcolor, listname, selection, trow, brow, lc, rc, getname, temp
  28. PRIV menuwidth, tvar, mtitle, save_scr, hlpmsg
  29. selection = 0
  30. oldcolor = Setcolor(c_norm)
  31.  
  32. *-----------------------------------------------------------------------
  33. *   determine which list to display by looking at the variable in memvar
  34. *   then construct needed macro variables to get list selection with
  35. *   achoice()
  36. *-----------------------------------------------------------------------
  37. DO CASE
  38.    CASE switch == "DBFPRNT" .OR. switch == 'DBF_ADD'
  39.       listname = "fi"                         && caller defines listname array
  40.       getname = "finame"                      && caller defines getname
  41.       mtitle = " Data Dictionary File List "
  42.    OTHERWISE
  43.       RETURN
  44. ENDCASE
  45.  
  46. *-----------------------------------------------------------------------
  47. *   build selection list window parameters and center title
  48. *-----------------------------------------------------------------------
  49. menuwidth = Len(&listname[1])                              && len of 1st array element
  50. IF Len(mtitle) > menuwidth
  51.    menuwidth = Len(mtitle)
  52. ELSE                  && pad title for centering
  53.    tlen = (menuwidth-Len(mtitle))/2
  54.    mtitle = Space(tlen)+Trim(mtitle)+Space(tlen)
  55.    IF Len(mtitle) != (Int(Len(mtitle)/2)*2)
  56.       mtitle = mtitle+' '
  57.    ENDIF
  58. ENDIF
  59. lc = 2                                                     && left col of window
  60. rc = 2+menuwidth+2                                         && right col of window
  61. trow = 2                                                   && top row of window
  62.  
  63. brow = trow + 4 + Len(&listname)                           && bottom row of window
  64. IF brow > 22
  65.    brow = 22
  66. ENDIF
  67.  
  68. *-------------------------------------------------
  69. *   save screen & build the window box, with title
  70. *-------------------------------------------------
  71. save screen to save_scr
  72. Setcolor(c_mbord)
  73. Scroll(trow,lc,brow,rc,0)
  74.  
  75. @ trow,lc TO brow,rc DOUBLE
  76. Setcolor(c_mtitl) 
  77. @ trow+1, lc + 2 say mtitle
  78. Setcolor(c_mbord)
  79. @ trow+2, lc say '╟'
  80. FOR i = lc+1 TO menuwidth+3
  81.    @ trow+2, i say '─'
  82. NEXT
  83. @ trow+2, rc say '╢'
  84. Setcolor(c_help)
  85. hlpmsg = "Highlight Selection and Press <Enter> to Select, or Press <Esc> to Quit"
  86. @ 23,Centr(hlpmsg,0) SAY hlpmsg
  87.  
  88. *---------------------------------------
  89. *   pop-up selection menu and get choice
  90. *---------------------------------------
  91.  
  92.    Setcolor(c_mtext)
  93.  
  94.    selection = Achoice(trow+4,lc+2,brow-1,rc-2,&listname)
  95.    Setcolor(c_norm)
  96.    IF selection > 0
  97.  
  98.       *----------------------------------------
  99.       * Put selected value into return variable
  100.       *----------------------------------------
  101.       &getname = &listname[selection]
  102.    ENDIF
  103.    restore screen from save_scr
  104. Setcolor(oldcolor)
  105. RELE ALL
  106. RETURN
  107. * EOF: Blist.prg
  108.