home *** CD-ROM | disk | FTP | other *** search
/ Windoware / WINDOWARE_1_6.iso / miscprog / wzall / wz006.txt < prev    next >
Text File  |  1991-01-24  |  6KB  |  112 lines

  1.                                  INFORMIX SOFTWARE, INC., LENEXA, KS
  2.                            Wingz Technical Support Bulletin Number 006
  3.            
  4.           Title:    Printing a full page chart
  5.           Date:     December 5, 1990
  6.            
  7.           Using hyperscript, you can get a full page print or print preview 
  8.           of  a chart without having to manually resize the chart yourself.  
  9.           The following example script will allow you to select a chart and 
  10.           print the chart full page.   Print size is assumed for margins of 
  11.           1  inch  top and bottom and .750 inches left  and  right.   Print 
  12.           orientation is landscape,  centering is on,  and report border is 
  13.           off.  To use this script, select a chart, then run the script. If 
  14.           you  wish to return to the exact same screen that you have before 
  15.           you  run  the  script,  select the upper left hand cell  of  your 
  16.           screen  before  selecting the chart to be  printed.  This  script 
  17.           assumes  current window scale to be 100%.   If not,  when  window 
  18.           reappears,  it  will  be rescaled to 100%.  You can  add  rescale 
  19.           window commands to the end of the script to rescale if necessary. 
  20.           This   script   will  alter  any  defined  report  print   range.  
  21.           IMPORTANT:  The variable p_opt ,  set by the dialog box,  must be 
  22.           referred to by the script name,  a colon,  and the variable name, 
  23.           p_opt (ie,  Chartpage:p_opt).   If you name the script you create 
  24.           anything  other  than  Chartpage  ,  you will need  to  make  the 
  25.           necessary  change  in the script where it accesses  the  variable 
  26.           Chartpage:p_opt.   If  you are running in an environment that has 
  27.           restrictions on file names or name lengths,  such as Windows 3.0, 
  28.           you may need to make this change.   Also,  if attaching script to 
  29.           an object on the worksheet,  such as a button, it is advisable to 
  30.           define  and refer to the p_opt variable in the sheet  script,  as 
  31.           variables  in  scripts  attached to objects on a  sheet  are  not 
  32.           accessible as global variables.
  33.            
  34.           Example Script:
  35.            
  36.           {***this is only an example with no implied warrantees***
  37.           ***use at your own risk, make a backup, etc.***}
  38.            
  39.           define o,startr,startc,r,c, rh,cw,p_opt                         { 
  40.           define p_opt  where necessary,
  41.                                                                           a 
  42.           s specified in explanation above.}
  43.           o = number()
  44.           Select object o
  45.           if cerror() <> 0                                                 
  46.           {  see if a chart has been selected}
  47.                 message "Select a graph before running script"
  48.                 exit script
  49.           end if
  50.            
  51.           new modal dialog box at (-1,-1) (2 inch, 1.5 inch)
  52.                add push button "OK" at (.5 inch, 1.1 inch)(1.5 inch,1.35 
  53.           inch)
  54.                dialog cancel push button
  55.                select control 1
  56.                dialog default push button
  57.                script "Chartpage:p_opt = ctvalue(2,0)"
  58.                add radio button "Page Preview...","Print..."
  59.                 at (.15 inch,.15 inch)(1.85 inch,.9 inch)
  60.                radio button 2
  61.           use dialog box
  62.           window size (0,0)                                               { 
  63.           window disappears, speeds processing}
  64.           window scale 1
  65.           startr = row()                                                  { 
  66.           gets location of last selected cell}
  67.           startc = col()
  68.           Copy
  69.           select Last Cell
  70.           r = row()
  71.           c = col()
  72.           go to cell makecell(c+1,r+1)
  73.           rh = rowheight()                                                 
  74.           {  find current row height}
  75.           cw = columnwidth()                                              { 
  76.           find current column height}
  77.           column width 13800                                              { 
  78.           may be adjusted for different margin sets}
  79.           row height 9400                                                  
  80.           {  may be adjusted for different margin sets}
  81.           Paste                                                           { 
  82.           creates graph of full page size}
  83.           Object Location frac(range(makecell(c+1,r+1)),5,5,250,250)
  84.           Object Name "tempchart"
  85.           go to cell makecell(c+1,r+1)
  86.           Report Print Range
  87.           Hide Headings
  88.           Message "Set Margins to 1 inch top and bottom, .750 left and 
  89.           right.  Set Center ON, Report Border OFF, and orientation to 
  90.           Landscape.  (May not be necessary if already properly set.)"
  91.           Page Setup                                                      { 
  92.           set the print options to print correctly}
  93.           if p_opt = 1 Page Preview end if                                { 
  94.           act on selected radio button}
  95.           if p_opt = 2 Print Dialog end if
  96.           Show Headings
  97.           Select object "tempchart"
  98.           Clear
  99.           select range makerange(c+1,1,c+1,32768)                         { 
  100.           reset the col and row size}
  101.           column width cw
  102.           select range makerange(1,r+1,32768,r+1)
  103.           row height rh
  104.           select range range(makecell(startc,startr))
  105.           Show Headings
  106.           repaint on
  107.           zoom window                                                     { 
  108.           window reappears full screen}
  109.           {end of script}
  110.  
  111.  
  112.