Open new window with same height and Y position as another

Just starting out? Need help? Post your questions and find answers here.
DontTalkToMe
Enthusiast
Enthusiast
Posts: 334
Joined: Mon Feb 04, 2013 5:28 pm

Re: Open new window with same height and Y position as anoth

Post by DontTalkToMe »

@rashad

that work for y, but the windows are not positioned at 200 and 300.

Anyway all these are just workarounds for a specific problem, the point is you don't get reliable information when using PB commands to query windows' metrics. The numbers you work with do not reflect the reality when you go to actually measure them, it's a problem when you need pixel perfect positioning of something.

try with your code

Code: Select all

Debug WindowX(0,#PB_Window_FrameCoordinate)
Debug WindowX(0,#PB_Window_InnerCoordinate)

Debug WindowX(1,#PB_Window_FrameCoordinate)
Debug WindowX(1,#PB_Window_InnerCoordinate)
and verify where they are in reality by counting actual pixels
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4991
Joined: Sun Apr 12, 2009 6:27 am

Re: Open new window with same height and Y position as anoth

Post by RASHAD »

No bug
It is how windows handle the DPI & Composition effect
With windows 10 there is a different way to handle such case
Another simple one

Code: Select all

y=200 ; Both windows should open at this vertical position!

OpenWindow(0,200,y,200,100,"Lower",#PB_Window_SystemMenu|#PB_Window_SizeGadget)
If OSVersion() > #PB_OS_Windows_Vista And OSVersion() < #PB_OS_Windows_10
  AdjustWindowRectEx_(r.RECT,#PB_Window_SizeGadget,0,0)
  AdjustWindowRectEx_(rr.RECT,#PB_Window_SystemMenu,0,0)
  yy = r\right - rr\right
EndIf
OpenWindow(1,300,y+yy,WindowWidth(0),WindowHeight(0),"Higher - why?",#PB_Window_SystemMenu)

Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
Egypt my love
DontTalkToMe
Enthusiast
Enthusiast
Posts: 334
Joined: Mon Feb 04, 2013 5:28 pm

Re: Open new window with same height and Y position as anoth

Post by DontTalkToMe »

Right ...

still a specific workaround and still the X position of both windows is off on win7 + aero, while using API + the linker file they are correctly at 200 and 300.

passing #PB_ constants which appears (at the moment) to be more or less coincident to win32 native windows' style combinations to an API is not a good idea IMO.

My efforts stop here, it's becoming a chore :|
Post Reply