|
pfc_pagesetupdlg
|
|
Full name
|
pfc_u_dw.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 if successful, 0 if user cancelled from page setup, -1 if error occured
// Description: Opens the page setup dialog for this DataWindow,
// and sets the page setup values the user selected for the DW.
//////////////////////////////////////////////////////////////////////////////
// Rev. History Version
// 5.0 Initial version
//////////////////////////////////////////////////////////////////////////////
// Copyright © 1996-1999 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"
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"
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"
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"
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"
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"
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"
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