1. Gimmy Susan
  2. PowerBuilder
  3. Thursday, 17 May 2018

Good morning.

A question about the resize.

I am developing my application with 1920x1200 resolution.
I want to open my frame with the largest possible size in a 1024x768 resolution mode.

It seems to me that powerbuilder has its Powerbuilder Unit.
How can I convert 1024x768 in width and hight?

Thanks for the reply

Gimmy

Accepted Answer
Michael Hartnett Accepted Answer Pending Moderation
0
Votes
Undo

Hi Gimmy,

You can use the PixelsToUnits() function to convert the Pixel Width/Height into the equivalent Powerbuilder Units.

integer Value

Value = PixelsToUnits(35, XPixelsToUnits!) //Width
Value = PixelsToUnits(35, YPixelsToUnits!) //Height

AS far as I know with Datawindows you can set the unit type and work natively with the dimensions, but for windows you should use the PixelsToUnits() conversion.

Michael

Comment
In addition to what Michael said above, look into the GetEnvironment function.  It returns an environment object.  You can then check environment.screenheight and environment.screenwidth (in pixels), then call PixelsToUnits on each for the maximum screen height and width.  This should work in any resolution.  Caveat: I had to add an offset to both to make it fit the screen perfectly.  You can experiment to get the right numbers, but I ended up with (-)800 for height and (-)100 for width.  Code would look something like this:



 



Long   ll_height, ll_width



Environment   le_env



CONSTANT   Integer   HEIGHT_OFFSET = 800



CONSTANT   Integer   WIDTH_OFFSET = 100



 



GetEnvironment(le_env)



ll_height = le_env.screenheight



ll_width = le_env.screenwidth



ll_width = PixelstoUnits(ll_width, XPixelsToUnits!)

ll_height = PixelstoUnits(ll_height, XPixelsToUnits!)



this.height = ll_height - HEIGHT_OFFSET  //from open or some window event - offset is optional

this.width = ll_width - WIDTH_OFFSET  //from open or some window event - offset is optional

  1. Kevin Ridley
  2. Thursday, 24 May 2018
There are no comments made yet.
  1. Thursday, 17 May 2018
  2. PowerBuilder
  3. # Permalink
Gimmy Susan Accepted Answer Pending Moderation
0
Votes
Undo

as always, just read the manual ........ but it is so big ..

= (

Comment
There are no comments made yet.
  1. Thursday, 17 May 2018
  2. PowerBuilder
  3. # 1
Marco Meoni Accepted Answer Pending Moderation
0
Votes
Undo

Hi Gimmy,

have a look at PixelsToUnits() and UnitsToPixels() functions.

Best,

.m

Comment
There are no comments made yet.
  1. Thursday, 17 May 2018
  2. PowerBuilder
  3. # 2
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.