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.

PowerBuilder coordinate system

8 posts in Powerscript Last posting was on 2009-09-09 08:18:16.0Z
Frerich Raabe Posted on 2009-09-02 10:17:07.0Z
Sender: 4c1b.4a9e454d.1804289383@sybase.com
From: Frerich Raabe
Newsgroups: sybase.public.powerbuilder.powerscript
Subject: PowerBuilder coordinate system
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4a9e4623.4c36.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 2 Sep 2009 03:17:07 -0700
X-Trace: forums-1-dub 1251886627 10.22.241.41 (2 Sep 2009 03:17:07 -0700)
X-Original-Trace: 2 Sep 2009 03:17:07 -0700, 10.22.241.41
Lines: 12
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27034
Article PK: 793524

Hi,

I just noticed that the coordinates which are issued by the
x/y/width/height properties are not in pixels but something
else. On my system, I noticed that the reported coordinates
are larger by the factor 4.57 (I suppose this is different
on other systems), so a window at position 960px has an 'x'
property of 4389. Does anybody know why that is, and is
there a portable function to translate PowerBuilder
coordinates into pixel coordinates?

- Frerich


Jeremy Lakeman Posted on 2009-09-02 11:57:03.0Z
From: Jeremy Lakeman <jeremy.lakeman@gmail.com>
Newsgroups: sybase.public.powerbuilder.powerscript
Subject: Re: PowerBuilder coordinate system
Date: Wed, 2 Sep 2009 04:57:03 -0700 (PDT)
Organization: http://groups.google.com
Lines: 18
Message-ID: <0aca5abc-8475-42bf-9b48-8bb6a3ef849c@o9g2000prg.googlegroups.com>
References: <4a9e4623.4c36.1681692777@sybase.com>
NNTP-Posting-Host: 122.49.168.173
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1251892627 21474 127.0.0.1 (2 Sep 2009 11:57:07 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 2 Sep 2009 11:57:07 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: o9g2000prg.googlegroups.com; posting-host=122.49.168.173; posting-account=euaBtgoAAAC_vDxfsxmpMKlBxHaHpmRS
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Path: forums-1-dub!forums-master!newssvr.sybase.com!news-sj-1.sprintlink.net!news-peer1.sprintlink.net!newsfeed.yul.equant.net!novia!news-out.readnews.com!news-xxxfer.readnews.com!postnews.google.com!o9g2000prg.googlegroups.com!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27038
Article PK: 761700


On Sep 2, 7:17 pm, Frerich Raabe wrote:
> Hi,
>
> I just noticed that the coordinates which are issued by the
> x/y/width/height properties are not in pixels but something
> else. On my system, I noticed that the reported coordinates
> are larger by the factor 4.57 (I suppose this is different
> on other systems), so a window at position 960px has an 'x'
> property of 4389. Does anybody know why that is, and is
> there a portable function to translate PowerBuilder
> coordinates into pixel coordinates?
>
> - Frerich

Yes. I believe the idea is to use the DPI setting of your display and
your printer when working out where everything should go.

Use unitstopixels / pixelstounits for conversion.


Frerich Raabe Posted on 2009-09-03 12:21:11.0Z
Sender: 7e2e.4a9fb07d.1804289383@sybase.com
From: Frerich Raabe
Newsgroups: sybase.public.powerbuilder.powerscript
Subject: Re: PowerBuilder coordinate system
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4a9fb4b7.7ea7.1681692777@sybase.com>
References: <0aca5abc-8475-42bf-9b48-8bb6a3ef849c@o9g2000prg.googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 3 Sep 2009 05:21:11 -0700
X-Trace: forums-1-dub 1251980471 10.22.241.41 (3 Sep 2009 05:21:11 -0700)
X-Original-Trace: 3 Sep 2009 05:21:11 -0700, 10.22.241.41
Lines: 47
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27040
Article PK: 793519


> On Sep 2, 7:17 pm, Frerich Raabe wrote:
> > I just noticed that the coordinates which are issued by
> > the x/y/width/height properties are not in pixels but
> > something else. On my system, I noticed that the
> > reported coordinates are larger by the factor 4.57 (I
> > suppose this is different on other systems), so a window
> > at position 960px has an 'x' property of 4389. Does
> > anybody know why that is, and is there a portable
> > function to translate PowerBuilder coordinates into
> pixel coordinates? >
> > - Frerich
>
> Yes. I believe the idea is to use the DPI setting of your
> display and your printer when working out where everything
> should go.
>
> Use unitstopixels / pixelstounits for conversion.

Ah, I see. Makes sense. However, I noticed an odd thing.

I'm trying to compute absolute position for my controls. For
instance, I'm computing the absolute coordinates of my main
form
(in pixels) like this:

int l_absx;
int l_absy;
l_absx = UnitsToPixels( w_sample1_main.x, XUnitsToPixels!
)
l_absy = UnitsToPixels( w_sample1_main.y, YUnitsToPixels!
)

However, at runtime, this gives me the top left corner of
the main window, so it's at the top left corner of the
Windows title bar. What I really meant was the top left
corner of the main form though, so I basically need the
coordinates as computed above plus the height of the Windows
title bar, menu bar, toolbar etc.

I basically need the 'client rect' coordinates of the
window.

Is there a function for this, or do I need to compute that
myself by adding up the height of th emenu bar, toolbar
(assuming the toolbar orientation is at the top) etc.?

- Frerich


Roland Smith [TeamSybase] Posted on 2009-09-03 19:18:40.0Z
From: "Roland Smith [TeamSybase]" <rsmith_at_trusthss_dot_com>
Newsgroups: sybase.public.powerbuilder.powerscript
References: <4a9fb4b7.7ea7.1681692777@sybase.com> <4a9fcedc.2f8.1681692777@sybase.com>
Subject: Re: PowerBuilder coordinate system
Lines: 52
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4aa01690$1@forums-1-dub>
Date: 3 Sep 2009 12:18:40 -0700
X-Trace: forums-1-dub 1252005520 10.22.241.152 (3 Sep 2009 12:18:40 -0700)
X-Original-Trace: 3 Sep 2009 12:18:40 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27043
Article PK: 793520

PowerBuilder objects use what is called a PBU ( PowerBuilder Unit ).

I've never heard of anyone trying to set object locations by pixels. What
benifit do you think you will have?

<Frerich Raabe> wrote in message news:4a9fcedc.2f8.1681692777@sybase.com...
Hi,

sorry for having to follow up to myself, just wanted to add
some information:

On Sep 2, 7:17 pm, Frerich Raabe wrote:
> I'm trying to compute absolute position for my controls.
> For instance, I'm computing the absolute coordinates of my
> main form (in pixels) like this:
>
> int l_absx;
> int l_absy;
> l_absx = UnitsToPixels( w_sample1_main.x,
XUnitsToPixels!)
> l_absy = UnitsToPixels( w_sample1_main.y,
YUnitsToPixels!)
>
> However, at runtime, this gives me the top left corner of
> the main window, so it's at the top left corner of the
> Windows title bar. What I really meant was the top left
> corner of the main form though, so I basically need the
> coordinates as computed above plus the height of the
> Windows title bar, menu bar, toolbar etc.

I noticed that it works considerably better if I use

w_sample1_main.WorkSpaceX()
w_sample1_main.WorkSpaceY()

instead. However, WorkSpaceY() still does not the height of
the
toolbar into account, so WorkSpaceY() is, in my case, below
the
menu bar but above the toolbar. I tried to compensate for
this
by adding w_sample1_main.ToolbarHeight to my l_absy
coordinate,
but unfortunately ToolbarHeight always returns zero.

It seems that the Toolbar is not a discrete control but
rather
a property of and Window or Menu. Hmm.

- Frerich


Frerich Raabe Posted on 2009-09-04 08:52:44.0Z
Sender: 271d.4aa0d4e8.1804289383@sybase.com
From: Frerich Raabe
Newsgroups: sybase.public.powerbuilder.powerscript
Subject: Re: PowerBuilder coordinate system
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4aa0d55c.2727.1681692777@sybase.com>
References: <4aa01690$1@forums-1-dub>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 4 Sep 2009 01:52:44 -0700
X-Trace: forums-1-dub 1252054364 10.22.241.41 (4 Sep 2009 01:52:44 -0700)
X-Original-Trace: 4 Sep 2009 01:52:44 -0700, 10.22.241.41
Lines: 17
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27048
Article PK: 793521


> PowerBuilder objects use what is called a PBU (
> PowerBuilder Unit ).
>
> I've never heard of anyone trying to set object locations
> by pixels. What benifit do you think you will have?

I'm using an external tool to automate my PowerBuilder GUI;
the
tool requires (in some situations) the absolute coordinates
of
an object to interact with (e.g. click on) in pixels. Hence,
I'm
creating some helper functions in my PowerBuilder GUI which
I can
call via to PBNI to determine this information.

- Frerich