I have written a very generalized calendar popup and need to calculate the position of where to popup the form based on a text field that holds the date. The FF function to get the position of a control gives it relative to the form where the control resides. I have an application with tabs within tabs and it seems that calculating where to popup the form is not easy to make generalized. The tabs themselves is not included when the FF function returns the position of a control.
Is there an easy way to calculate the relative position of a control on a form relative to the outermost form when forms are nested on forms using tabs? This is necessary since to make the popup modal you must specify the top level form as the parent to the popup.
Thanks.
Hello Mark
have you had a look at http://planetsquires.com/support/index.php?topic=2295.0 (http://planetsquires.com/support/index.php?topic=2295.0)
Marc
Hi Mark,
Follow Marc's link for determining relative positioning. If you want to know what the top level window is for a deeply nested control then try code like the following:
Function GetTopLevelWindow( ByVal hWnd As DWord ) as DWord
' Determine the top level window of the specified control
WHILE ISTRUE (GetWindowLong(hWnd, %GWL_STYLE) AND %WS_CHILD)
IF ISTRUE (GetWindowLong(hWnd, %GWL_EXSTYLE) AND %WS_EX_MDICHILD) THEN EXIT LOOP
hWnd = GetParent(hWnd)
WEND
FUNCTION = hWnd
End Function