Arnaud de Montard | 16 May 10:21

Re: Printing page 1 of X


Le 16 mai 08 à 03:59, Guy Algot a écrit :

> I was hoping to not go thru what you have done to get it to work.  
> Print the form, get the #, cancel it, then print for real. Never as  
> easy as it seems. ;-)
>
> So if you suppress the PRINT FORM, how are you getting the height of  
> each section?

You can't: only the form "knows" the objects (markers, fields and so  
on), and only its method form can read positions, resize them, and  
accept or not printing with CANCEL.

I use a wrapper of PRINT FORM, something like this:
   wrapPrintForm (->table;form{;printMarker{;maxHeight{;truncHeight) - 
 > height of printed section
when I pass $4 maxHeight =0, wrapPrintForm calculates but does not  
print. I use 4 process variables to send and receive params between  
wrapper and method form (pseudo params), as below.

   `method form
...
   `read pseudo params from process var:
$lMarker:=vl_printMarker  `$3 in wrapPrintForm
$lmaxHeight:=vl_maxHeight  `$4 in wrapPrintForm
   `read form objects
$lPosMarker:=Get print marker($lMarker)
$lPosPreviousMarker:=getPosPreviousMarker($lMarker)
$lBeforeResize:=$lPosMarker-$lPosPreviousMarker
Case of
	: ($lMarker=Form Detail )
		$lRedim:=...wrap_BEST_OBJECT_SIZE(->Object)...
		$lNewPosMarker:=$lPosMarker+$lRedim
		If (($lBeforeResize+$lRedim)>$lmaxHeight)  `too much
			CANCEL
		Else   `print
			`do SET PRINT MARKER and MOVE OBJECT
		End if
End case
vlPrintedHeight:=$lRedim+$lBeforeResize  `$0 in wrapPrintForm

as you said, never as easy as it seems. ;-)

--

-- 
Arnaud de Montard

**********************************************************************
The 4D v11 SQL Roadshow - coming to a city near you!
http://www.4D.com/roadshow/index.html

4th Dimension Internet Users Group (4D iNUG)
FAQ:  http://www.4d.com/support/faqnug.html
Archive:  http://dir.gmane.org/gmane.comp.lang.inug-4d.tech
Unsub:  mailto:4D_Tech-Unsubscribe@...
Post: mailto:4d_tech@...
Options: https://lists.4d.com/mailman/listinfo/4d_tech
**********************************************************************


Gmane