version 2003 (Modified)
SET PRINT MARKER (markNum; position{; *})
Parameter | Type | Description | |
markNum | Number | Marker number | |
position | Number | New position for the marker | |
* | * | If passed = move subsequent markers | |
If omitted = do not move subsequent markers |
Description
The SET PRINT MARKER command enables the definition of the marker position during printing. Combined with the Get print marker, MOVE OBJECT or Print form commands, this command allows you to adjust the size of the print areas.
SET PRINT MARKER can be used in two contexts:
during the On header form event, in the context of PRINT SELECTION and PRINT RECORD commands.
during the On Printing Detail form event, in the context of the Print form command. This operation facilitates the printing of customized reports (see example).
The effect of the command is limited to printing; no modification appears on the screen. The modifications made to the forms are not saved.
Pass one of the constants of the Form area theme in the markNum parameter:
Constant | Type | Value |
Form Header | Longint | 200 |
Form Header1...10 | Longint | 201...210 |
Form Detail | Longint | 0 |
Form Break0...9 | Longint | 300...309 |
Form Footer | Longint | 100 |
In position, pass the new position desired, expressed in pixels.
If you pass the optional * parameter, all the markers located below the marker specified in markNum will be moved the same number of pixels and in the same direction as this marker when the command is executed. Warning: in this case, any objects present in the areas located below the marker are also moved.
When the * parameter is used, it is possible to position the markNum marker beyond the initial position of the markers that follow it these latter markers will be moved simultaneously.
Notes:
This command modifies only the existing marker position. It does not allow the addition of markers. If you designate a marker that does not exist in the form, the command will not do anything.
The print marker mechanism in the Structure mode is retained: a marker cannot go any higher than the one that precedes it, nor any lower than the one that follows it (when the * parameter is not used).
Example
This complete example enables you to generate the printing of a three-column report, the height of each row being calculated on the fly according to the contents of the fields.
The output form used for printing is as follows:
The On Printing Detail form event was selected for the form (keep in mind that no matter what area is printed, the Print form command only generates this type of form event).
For each record, the row height must be adapted according to the contents of the "Actors" or "Summary" column (column having the most content). Here is the desired result:
The print project method is as follows:
C_LONGINT(vLprint_height;$vLheight;vLprinted_height) C_STRING(31;vSprint_area) PAGE SETUP([Film];"Print_List3") GET PRINTABLE AREA(vLprint_height) vLprinted_height:=0 ALL RECORDS([Film]) vSprint_area:="Header" `Printing of header area $vLheight:=Print form([Film];"Print_List3";Form Header) $vLheight:=21 `Fixed height vLprinted_height:=vLprinted_height+$vLheight While(Not(End selection([Film]))) vSprint_area:="Detail" `Printing of detail area $vLheight:=Print form([Film];"Print_List3";Form Detail) `Detail calculation is carried out in the form method vLprinted_height:=vLprinted_height+$vLheight If(OK=0) `CANCEL has been carried out in the form method PAGE BREAK vLprinted_height:=0 vSprint_area:="Header" `Reprinting of the header area $vLheight:=Print form([Film];"Print_List3";Form Header) $vLheight:=21 vLprinted_height:=vLprinted_height+$vLheight vSprint_area:="Detail" $vLheight:=Print form([Film];"Print_List3";Form Detail) vLprinted_height:=vLprinted_height+$vLheight End if NEXT RECORD([Film]) End while PAGE BREAK `Make sure that the last page is printed
The Print_List3 form method is as follows:
C_LONGINT($l;$t;$r;$b;$fixed_wdth;$exact_hght;$l1;$t1;$r1;$b1) C_LONGINT($final_pos;$i) C_LONGINT($detail_pos;$header_pos;$hght_to_print;$hght_remaining) Case of : (vSprint_area="Detail") `Printing of detail underway GET OBJECT RECT([Film]Actors;$l;$t;$r;$b) $fixed_wdth:=$r-$l `Calculation of the Actors text field size $exact_hght:=$b-$t BEST OBJECT SIZE([Film]Actors;$wdth;$hght;$fixed_wdth) `Optimal size of the field according to its contents $movement:=$hght-$exact_hght GET OBJECT RECT([Film]Summary;$l1;$t1;$r1;$b1) $fixed_wdth1:=$r1-$l1 `Calculation of the Summary text field size $exact_hght1:=$b1-$t1 BEST OBJECT SIZE([Film]Summary;$wdth1;$hght1;$fixed_wdth1) `Optimal size of the field according to its contents $movement1:=$hght1-$exact_hght1 If($movement1>$movement) `We determine the highest field $movement:=$movement1 End if If($movement>0) $position:=Get print marker(Form Detail) $final_pos:=$position+$movement `We move the Detail marker and those that follow it SET PRINT MARKER(Form Detail ;$final_pos;*) `Resizing of text areas MOVE OBJECT([Film]Actors;$l;$t;$r;$hght+$t;*) MOVE OBJECT([Film]Summary;$l1;$t1;$r1;$hght1+$t1;*) `Resizing of dividing lines GET OBJECT RECT(*;"H1Line";$l;$t;$r;$b) MOVE OBJECT(*;"H1Line";$l;$final_pos-1;$r;$final_pos;*) For ($i;1;4;1) GET OBJECT RECT(*;"VLine"+String($i);$l;$t;$r;$b) MOVE OBJECT(*;"VLine"+String($i);$l;$t;$r;$final_pos;*) End for End if `Calculation of available space $detail_pos:=Get print marker(Form Detail) $header_pos:=Get print marker(Form Header) $hght_to_print:=$detail_pos-$header_pos $hght_remaining:=printing_height-vLprinted_height If($hght_remaining<$hght_to_print) `Insufficient height CANCEL `Move form to the next page End if End case
See Also
BEST OBJECT SIZE, GET OBJECT RECT, Get print marker, MOVE OBJECT, PAGE BREAK, Print form, PRINT RECORD, PRINT SELECTION.