home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP25.EXE / CHP2503.PRG < prev    next >
Encoding:
Text File  |  1991-06-12  |  1.3 KB  |  44 lines

  1. /*
  2.    Listing 25.3. Function that makes all columns in a
  3.                  browse more wide or more narrow by a
  4.                  specified amount.
  5.    Author: Craig Yellick
  6.    Excerpted from "Clipper 5: A Developer's Guide"
  7.    Copyright (c) 1991 M&T Books
  8.                       501 Galveston Drive
  9.                       Redwood City, CA 94063-4728
  10.                       (415) 366-3600
  11. */
  12.  
  13. function Widen(objBrow, nHowMuch)
  14. /*
  15.    Given a browse object, make all columns wider
  16.    by specified amount. (Negative = more narrow).
  17.    Prevents column from being smaller than one or
  18.    larger than the width of the window. Note: Browse
  19.    object must have window coordinates defined.
  20. */
  21. local i, objCol, wid
  22.  
  23.   //  Loop once for each column in the browse.
  24.   for i := 1 to objBrow:colCount
  25.  
  26.     //  Extract a column object.
  27.     objCol := objBrow:getColumn(i)
  28.  
  29.     //  Add the amount to widen or narrow
  30.     //  to the column's current width.
  31.     wid := objCol:width + nHowMuch
  32.  
  33.     //  Trap for extremes, less than 1 or
  34.     //  greater than width of browse window.
  35.     objCol:width := min(max(wid, 1), ;
  36.                     (objBrow:nRight - objBrow:nLeft) +1)
  37.  
  38.     //  Replace modified column object.
  39.     objBrow:setColumn(i, objCol)
  40.   next i
  41. return nil
  42.  
  43. // end of file CHP2503.PRG
  44.