Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

DataWindow printing - Margins

3 posts in DataWindow Last posting was on 2008-09-25 15:15:45.0Z
Daniel dcferreira [at] attps [.] com [.] br Posted on 2008-08-29 14:50:15.0Z
Sender: 7fc5.48b806b7.1804289383@sybase.com
From: Daniel dcferreira [at] attps [.] com [.] br
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: DataWindow printing - Margins
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <48b80ca7.248.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 29 Aug 2008 07:50:15 -0700
X-Trace: forums-1-dub 1220021415 10.22.241.41 (29 Aug 2008 07:50:15 -0700)
X-Original-Trace: 29 Aug 2008 07:50:15 -0700, 10.22.241.41
Lines: 49
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:87670
Article PK: 416926

Hi guys,

This is a continuation of a previows thread, same name. I
didn't use the old one because I wasn't sure if anyone would
read it.

Since I didn't get the DLL call to get the printer margins
to work, I did as you suggested: used a reference DW in
witch I increse the detail height until i get 2 vertical
pages, and increse a rectangle object until I get 2
horizontal pages. This is all working fine (although a bit
slow), but now I've come with another issue I can't seem do
solve.
When I call PrinterSetup(), as to change the paperSize from
A4 to Letter, I call my function to get the new printing
scale. The weird thing is, even calling my function with
with a post method, I keep getting the previous scale!

Ex:
I know that my function returns 99 when using A4, and 93
when using letter (because my reports are built for A4, but
some customers have letter, thats where my need came from)

My app open:
GetScale() // returns 99, for the default paper is A4

In a window with a dw I want to print:
PrinterSetup() // to change the paper to letter, my test
case
GetScale() // still returns 99, for the default paper is A4

If I call PrinterSetup() again, and cancel the popup, or if
I call my GetScale N time, I still get 99 as a result. If I
call printerSetup() and change the paper back to A4, THEN
the 93 shows!!!!

PrinterSetup() // to change the paper back to A4
GetScale() // returns 93, the value it should have returned
when I set it to letter!!!! :(

And this keeps happening every time...

I tried posting the function GetScale, tried calling
printOpen and printClose, but nothing worked, I kept getting
the previows values...

Please, any ideas?

This should be simple, but it's taking forever! :(


Daniel dcferreira [at] attps [.] com [.] br Posted on 2008-08-29 15:17:15.0Z
Sender: 7fc5.48b806b7.1804289383@sybase.com
From: Daniel dcferreira [at] attps [.] com [.] br
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: DataWindow printing - Margins
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <48b812fb.3bf.1681692777@sybase.com>
References: <48b80ca7.248.1681692777@sybase.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="-=_forums-1-dub48b812fb"
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 29 Aug 2008 08:17:15 -0700
X-Trace: forums-1-dub 1220023035 10.22.241.41 (29 Aug 2008 08:17:15 -0700)
X-Original-Trace: 29 Aug 2008 08:17:15 -0700, 10.22.241.41
Lines: 3198
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:87671
Article PK: 416927

Here is a small application, just o sample what I described.

If you change the paper size, it won't change the scale,
except when you "rechange" it, then it will get the previous
value...
If you change the printer itself, it will function
properly!!!!!

By the way, I'm using PB8.0!!!!!

Thanks

Save Format v3.0(19990112)
appname "testapp";
applib "testapp.pbl";
liblist "testapp.pbl";
type "pb";


Daniel dcferreira [at] attps [.] com [.] br Posted on 2008-09-25 15:15:45.0Z
Sender: 2cb9.48dba883.1804289383@sybase.com
From: Daniel dcferreira [at] attps [.] com [.] br
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: DataWindow printing - Margins - GetDeviceCaps
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <48dbab21.2d06.1681692777@sybase.com>
References: <48b80ca7.248.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 25 Sep 2008 08:15:45 -0700
X-Trace: forums-1-dub 1222355745 10.22.241.41 (25 Sep 2008 08:15:45 -0700)
X-Original-Trace: 25 Sep 2008 08:15:45 -0700, 10.22.241.41
Lines: 84
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:87849
Article PK: 417105

Hello all,

this is just sample script, on how I finally got the first
part of my script to work. I'm posting it here, in case
somebody else needs to get the "GetDeviceCaps" working. The
script is still incomplete. Now I need to know how to
convert from the device units to PB units. I'll post it
again when I do.
It's on PB10, and have it on PB8. The only difference is
that the PRP_GetDC external function might be on PBVM
instead of PBSHR.

*** External Functions ***
Public Function uLong GetDeviceCaps(ulong hDC, ulong nIndex)
LIBRARY "GDI32.DLL"
Public Function Long PRP_GetDC (long printjob) library
"PBSHR100.DLL" alias for "PRP_GetDC"

*** My script ***
Constant Long HORZRES = 8
Constant Long VERTRES = 10
Constant Long LOGPIXELSX = 88
Constant Long LOGPIXELSY = 90
Constant Long PHYSICALWIDTH = 110
Constant Long PHYSICALHEIGHT = 111
Constant Long PHYSICALOFFSETX = 112
Constant Long PHYSICALOFFSETY = 113

Ulong ll_printJob
uLong lul_Printer
String ls_PrinterName

// My structure to get the info
str_printArea lstr_printArea

// Get Current Printer Name, just to be complete
ls_PrinterName = PrintGetPrinter()
ls_PrinterName = Left(ls_PrinterName, Pos(ls_PrinterName,
"~t") - 1)

// Open Current Printer and get Handle to it
ll_printJob = PrintOpen('PrinterConfig', False)
if ll_printJob > 0 Then
lul_Printer = PRP_GetDC (ll_printJob)

lstr_printArea.resolution_X = GetDeviceCaps(lul_printer,
HORZRES )
lstr_printArea.resolution_Y = GetDeviceCaps(lul_printer,
VERTRES )
lstr_printArea.printorigin_X = GetDeviceCaps(lul_printer,
PHYSICALOFFSETX )
lstr_printArea.printorigin_Y = GetDeviceCaps(lul_printer,
PHYSICALOFFSETY )
lstr_printArea.pageRect_Left = 0
lstr_printArea.pageRect_Right = GetDeviceCaps(lul_printer,
PHYSICALWIDTH )
lstr_printArea.pageRect_Top = 0
lstr_printArea.pageRect_Bottom = GetDeviceCaps(lul_printer,
PHYSICALHEIGHT )
lstr_printArea.logicalPixels_X = GetDeviceCaps(lul_printer,
LOGPIXELSX)
lstr_printArea.logicalPixels_Y = GetDeviceCaps(lul_printer,
LOGPIXELSY)

// Clean Up
PrintCancel(ll_printJob)
END IF


*** My structure ***
global type str_printarea from structure
unsignedlong resolution_x
unsignedlong resolution_y
unsignedlong printorigin_x
unsignedlong printorigin_y
unsignedlong pagerect_left
unsignedlong pagerect_right
unsignedlong pagerect_top
unsignedlong pagerect_bottom
unsignedlong LogicalPixels_x
unsignedlong logicalPixels_y
end type

Good Luck to all.