1. Mayller Lopez
  2. PowerBuilder
  3. Wednesday, 30 December 2020 10:50 AM UTC

Hi Everyone,

I have a calendar control which was working fine in 32bit (Calendar 32Bit.JPG), but after compiling in 64bit the calendar control appearing outside the application window as per attached (Calendar 64Bit.JPG), Im using PB 12.6 B4138. The behavior should be same as the 32bit application.

 

Below is the code function executed when button is clicked beside the text box (ROS Date)

POINT structure is in longlong as per changed in my previous problem which was fixed.

-------------------------------------------------------

long ll_i, ll_X, ll_Y, ll_DWx, ll_Height, ll_Split
string ls_s
POINT lPoint
Environment Env

GetEnvironment(Env)

ls_s = iDW.Describe(is_column + ".X")
ll_i = Pos(ls_s, "~t")
IF ll_i > 0 THEN ls_s = Mid(ls_s, ll_i + 1, Len(ls_s) - (ll_i + 1))
ll_X = UnitsToPixels(Long(iDW.Describe("Evaluate('" + ls_s + "', " + String(il_row) + ")")), XUnitsToPixels!)

ls_s = iDW.Describe(is_column + ".Y")
ll_i = Pos(ls_s, "~t")
IF ll_i > 0 THEN ls_s = Mid(ls_s, ll_i + 1, Len(ls_s) - (ll_i + 1))
ll_Y = UnitsToPixels(Long(iDW.Describe("Evaluate('" + ls_s + "', " + String(il_row) + ")")), YUnitsToPixels!)
IF ll_X = 0 OR ll_Y = 0 THEN RETURN


ll_Height = UnitsToPixels(Long(iDW.Describe(is_column + ".Height")), YUnitsToPixels!) + 2

ll_Split = UnitsToPixels(Long(iDW.Describe("DataWindow.HorizontalScrollSplit")), XUnitsToPixels!) - 1
IF ll_Split > 0 AND UnitsToPixels(iDW.PointerX(), XUnitsToPixels!) > ll_Split + 5 THEN
    ll_X += - UnitsToPixels(Long(iDW.Describe("DataWindow.HorizontalScrollPosition2")), XUnitsToPixels!) + ll_Split + 5
ELSE
    ll_X -= UnitsToPixels(Long(iDW.Describe("DataWindow.HorizontalScrollPosition")),  XUnitsToPixels!)
END IF

ll_DWx = UnitsToPixels(iDW.X, XUnitsToPixels!)
ll_X += ll_DWx
ll_Y += UnitsToPixels(iDW.Y, YUnitsToPixels!) + UnitsToPixels(Long(iDW.Describe("DataWindow.Header.Height")), YUnitsToPixels!) + (il_row - Long(iDW.Describe("DataWindow.FirstRowOnPage"))) * UnitsToPixels(Long(iDW.Describe("DataWindow.Detail.Height")), YUnitsToPixels!) + 1

lPoint.X = ll_X
lPoint.Y = ll_Y
Externs.ClientToScreen(Externs.GetParent(Handle(iDW)), lPoint)
IF lPoint.X <= 0 THEN lPoint.X --

IF lPoint.X < 0 THEN lPoint.X = 0
IF lPoint.X + UnitsToPixels(This.Width, XUnitsToPixels!) > Env.ScreenWidth THEN
    lPoint.X = Env.ScreenWidth - UnitsToPixels(This.Width, XUnitsToPixels!)
END IF
    
IF lPoint.Y + ll_Height + UnitsToPixels(This.Height, YUnitsToPixels!) > Env.ScreenHeight THEN
    lPoint.Y -= UnitsToPixels(This.Height, YUnitsToPixels!)
ELSE
    lPoint.Y += ll_Height
END IF

Move(PixelsToUnits(lPoint.X, XPixelsToUnits!), PixelsToUnits(lPoint.Y, YPixelsToUnits!))

If il_shadow_width > 0 Then iuo_shadow.CaptureDesktop(This)

Externs.SetWindowPos(Handle(This), -1, 0, 0, 0, 0, 67)
-----------------------------------

Appreciate the help.

TIA.

Attachments (2)
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 30 December 2020 15:14 PM UTC
  2. PowerBuilder
  3. # 1

Hi Mayller;

   That could be an issue ib PB 12.x as the UnitsToPixels() command used Integer as its working data type. Whereas the new PB 2019 R3 from Appeon changed this & related commands to work as a Long data type. http://docs.appeon.com/pb2019r3/whats_new/PBU_enhancements.html

   Have you tried your code in PB 2019 R3 Beta to see if it works (Beta Download)?

Regards ... Chris

Comment
  1. Armeen Mazda @Appeon
  2. Monday, 4 January 2021 05:05 AM UTC
Thanks for sharing the solution!
  1. Helpful
  1. Chris Pollach @Appeon
  2. Monday, 4 January 2021 17:02 PM UTC
Yes, you need to always handle the screen co-ordinates and units in a Long data type. If you were using the API's instead off PB Unit commands, you would have already been using Long. Yes, for any screen calculations moving forward with PB2019R3 'Long" DT, you may need to use a LongLong in the interim calculation to make sure that you do not overflow.

I am super glad that you found the error in your code! :-)
  1. Helpful
  1. John Fauss
  2. Monday, 4 January 2021 18:50 PM UTC
That IS good news!



I suspect the correction in your POINT structure was also the root cause of your other API-related issue and why passing an eight-byte LongLong "worked". Translating the TypeDef'd datatypes used in the Windows API into the proper PB equivalent datatypes is extremely important.
  1. Helpful
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.