|
pfc_pagesetupdlg
|
|
Full name
|
pfc_n_ds.pfc_pagesetupdlg
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
event integer pfc_pagesetupdlg(ref s_pagesetupattrib)
|
Name
|
Datatype
|
li_margin
|
integer
|
li_papersize
|
integer
|
li_papersource
|
integer
|
li_units
|
integer
|
ll_rc
|
long
|
lnv_platform
|
n_cst_platform
|
ls_margin
|
string
|
ls_papersize
|
string
|
ls_papersource
|
string
|
ls_portraitorientation
|
string
|
ls_units
|
string
|
event pfc_pagesetupdlg;//////////////////////////////////////////////////////////////////////////////
//
// Event: pfc_pagesetupdlg
//
// Arguments:
// astr_pagesetup: page setup structure by ref
//
// Returns: integer
// 1 = success
// 0 = user cancelled from page setup
// -1 = error
//
// Description:
// Opens the page setup dialog for this DataWindow,
// and sets the page setup values the user selected for the DW.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
integer li_margin
integer li_papersize
integer li_papersource
integer li_units
string ls_margin
string ls_papersize
string ls_papersource
string ls_portraitorientation
string ls_units
long ll_rc
n_cst_platform lnv_platform
// Initialize pagesetup structure with current values of DW
// Margin bottom
ls_margin = this.object.datawindow.print.margin.bottom
if not IsNumber (ls_margin) then
ls_margin = "0"
end if
li_margin = Integer (ls_margin)
astr_pagesetup.i_marginbottom = li_margin
// Margin left
ls_margin = this.object.datawindow.print.margin.left
if not IsNumber (ls_margin) then
ls_margin = "0"
end if
li_margin = Integer (ls_margin)
astr_pagesetup.i_marginleft = li_margin
// Margin right
ls_margin = this.object.datawindow.print.margin.right
if not IsNumber (ls_margin) then
ls_margin = "0"
end if
li_margin = Integer (ls_margin)
astr_pagesetup.i_marginright = li_margin
// Margin top
ls_margin = this.object.datawindow.print.margin.top
if not IsNumber (ls_margin) then
ls_margin = "0"
end if
li_margin = Integer (ls_margin)
astr_pagesetup.i_margintop = li_margin
// DataWindow units
ls_units = this.object.datawindow.units
if not IsNumber (ls_units) then
ls_units = "0"
end if
li_units = Integer (ls_units)
if li_units < 2 then
astr_pagesetup.b_disablemargins = true
end if
astr_pagesetup.i_units = li_units
// Paper Size
ls_papersize = this.object.datawindow.print.paper.size
if not IsNumber (ls_papersize) then
ls_papersize = "0"
end if
li_papersize = Integer (ls_papersize)
astr_pagesetup.i_papersize = li_papersize
// Paper Source
ls_papersource = this.object.datawindow.print.paper.source
if not IsNumber (ls_papersource) then
ls_papersource = "0"
end if
li_papersource = Integer (ls_papersource)
astr_pagesetup.i_papersource = li_papersource
// Orientation
ls_portraitorientation = this.object.datawindow.print.orientation
if ls_portraitorientation = "0" then
SetNull (astr_pagesetup.b_portraitorientation)
elseif ls_portraitorientation = "2" then
astr_pagesetup.b_portraitorientation = true
end if
// Allow pagesetup structure to have additional values
// set before opening print dialog
this.event pfc_prepagesetupdlg (astr_pagesetup)
// Open page setup dialog
f_setplatform (lnv_platform, true)
ll_rc = lnv_platform.of_PageSetupDlg (astr_pagesetup)
f_setplatform (lnv_platform, false)
// Set page setup values based on users selection
if ll_rc > 0 then
// Margins
this.object.datawindow.print.margin.bottom = astr_pagesetup.i_marginbottom
this.object.datawindow.print.margin.left = astr_pagesetup.i_marginleft
this.object.datawindow.print.margin.right = astr_pagesetup.i_marginright
this.object.datawindow.print.margin.top = astr_pagesetup.i_margintop
// Paper Size
this.object.datawindow.print.paper.size = astr_pagesetup.i_papersize
// Paper Source
this.object.datawindow.print.paper.source = astr_pagesetup.i_papersource
// Orientation
if IsNull (astr_pagesetup.b_portraitorientation) then
this.object.datawindow.print.orientation = 0
elseif not astr_pagesetup.b_portraitorientation then
this.object.datawindow.print.orientation = 1
elseif astr_pagesetup.b_portraitorientation then
this.object.datawindow.print.orientation = 2
end if
end if
return ll_rc
end event