home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 25.3. Function that makes all columns in a
- browse more wide or more narrow by a
- specified amount.
- Author: Craig Yellick
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
- */
-
- function Widen(objBrow, nHowMuch)
- /*
- Given a browse object, make all columns wider
- by specified amount. (Negative = more narrow).
- Prevents column from being smaller than one or
- larger than the width of the window. Note: Browse
- object must have window coordinates defined.
- */
- local i, objCol, wid
-
- // Loop once for each column in the browse.
- for i := 1 to objBrow:colCount
-
- // Extract a column object.
- objCol := objBrow:getColumn(i)
-
- // Add the amount to widen or narrow
- // to the column's current width.
- wid := objCol:width + nHowMuch
-
- // Trap for extremes, less than 1 or
- // greater than width of browse window.
- objCol:width := min(max(wid, 1), ;
- (objBrow:nRight - objBrow:nLeft) +1)
-
- // Replace modified column object.
- objBrow:setColumn(i, objCol)
- next i
- return nil
-
- // end of file CHP2503.PRG
-