-
Konstantin Goldobin
- PowerBuilder
- Monday, 14 April 2025 11:17 AM UTC
Hello,
It's a very basic PB question but somehow I haven't been able to find an answer. If it matters, I'm using PB 2019 R3.
I'm trying to move a window to the centre of an MDI sheet both horizontally and vertically. To do this, I need to get the X and Y position of the sheet relative to the screen. Adding the MDI frame's X and MDI_1's X to the sheet's X works just fine:
li_x = aw_sheet.x + mdi_frame.x + mdi_frame.mdi_1.x
However, the same approach does not seem to work for Y; the following returns the wrong value:
li_y = aw_sheet.y + mdi_frame.y + mdi_frame.mdi_1.y
I noticed two things:
1. The MDI_1.y is adjusted for the height of toolbars but not for the frame's title bar or menu bar height (I'm not using ribbons in the application, so I can't say anything about it). In other words, if toolbars are disabled or moved away from the top, mdi_1.y is 0.
2. If the frame is maximized, its Y is -32.
Am I missing something obvious here? Do these two observations have a known explanation? And does anybody know a reliable way of getting the Y position of an MDI sheet relative to the screen?
Thanks!
K
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.