1. Gimmy Susan
  2. PowerBuilder
  3. Thursday, 17 May 2018 07:55 AM UTC

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
  1. Thursday, 17 May 2018 09:54 AM UTC
  2. PowerBuilder
  3. # Permalink

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
  1. Kevin Ridley
  2. Thursday, 24 May 2018 19:02 PM UTC
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. Helpful
There are no comments made yet.
Marco Meoni Accepted Answer Pending Moderation
  1. Thursday, 17 May 2018 10:10 AM UTC
  2. PowerBuilder
  3. # 1

Hi Gimmy,

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

Best,

.m

Comment
There are no comments made yet.
Gimmy Susan Accepted Answer Pending Moderation
  1. Thursday, 17 May 2018 12:47 PM UTC
  2. PowerBuilder
  3. # 2

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

= (

Comment
There are no comments made yet.
  • Page :
  • 1


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