home *** CD-ROM | disk | FTP | other *** search
- /* ================================================= */
- /* Final Data ARexx Macro */
- /* FitToWindow - Fit all columns into the window. */
- /* $VER: FitToWindow 1.0 (3.8.94) */
- /* © 1994 SoftWood, Inc. */
- /* Use of this macro is strictly at the user's risk. */
- /* ================================================= */
- OPTIONS RESULTS
-
- minColumnWidth = 20 /* Minimum size to make a column (in screen pixels) */
- rowHdrWidth = 57 /* Width of row numbers - for low res screens use 69 */
- scrollBarWidth = 18 /* Width of the right scroll bar. */
-
-
- /* ------------------------------------------------------- */
- /* Get the number of columns. If 0 the exit with an error. */
- /* ------------------------------------------------------- */
- NumColumns
- ncols = RESULT
- IF ( ncols = 0 ) THEN DO
- ShowMessage 1 1 '"No columns defined." "" "" "OK" "" ""'
- EXIT 10
- END
-
- /* ------------------------------------------------ */
- /* Get the window's width and subtract off the area */
- /* for the row buttons and the right scroll bar. */
- /* ------------------------------------------------ */
- GetWindowInfo
- windowWidth = WORD(RESULT, 3)
- dbWidth = windowWidth - rowHdrWidth - scrollBarWidth
-
- /* --------------------------------------------------- */
- /* To find the new column widths divide dbWidth by the */
- /* number of columns. Make sure the column width is */
- /* not smaller than our minimum column width. */
- /* --------------------------------------------------- */
- colWidth = dbWidth % ncols
- IF ( colWidth < minColumnWidth ) THEN
- colWidth = minColumnWidth
-
- /* ---------------------------------------------------------------- */
- /* Turn off current selection. If we can't then exit with an error. */
- /* ---------------------------------------------------------------- */
- SelectOff
- IF ( RC ~= 0 ) THEN DO
- ShowMessage 1 1 '"Cannot continue." "Check cell for invalid data." "" "OK" "" ""'
- EXIT 10
- END
-
- /* ----------------------------------------------------- */
- /* Set the width of each column to our new column width. */
- /* ----------------------------------------------------- */
- DO c = 1 to ncols
- GetColumnID POSITION c
- InitModifyColumn RESULT
- DefineColumn WIDTH colWidth
- ModifyColumn
- END /* DO c */
-
-
- /* End of file */