Panel gets covered by windows taskbar
by Wil van Antwerpen
The autolocate logic that Data-access uses doesn't take the
taskbar at the bottom of your screen into its calculations. As a result of this popping up
a selectionlists from a dbform object at the bottom of the screen will display the lookup
with its buttons covered by the statusbar and/or the windows taskbar.
The problem is in the global function GUIScreen_Size, right now it uses the
API-function GetSystemMetrics. With the parameters SM_CYSCREEN and SM_CXSCREEN. This
retrieves the full width and the height of the screen. An alternative for this is the
API-function call SystemParametersInfo. It does exactly the
same, but returns the full size of the workarea.
Dropping the following code into the top of your code will get rid of this most
annoying problem. While it doesn't exactly replace the original function it
does get called instead of it, because of the delegation path.
// *WvA: 02-02-2000
//
External_Function vWin32_SystemParametersInfo "SystemParametersInfoA" User32.dll
;
dword uiAction dword uiParam Pointer pvParam dword fWinini Returns Integer
Define vSPI_GETWORKAREA for 48
// This is a replacement for the GUIScreen_Size. The normal function uses the
// GetSystemMetrics to get the workable screensize. The systemmetric API call doesn't
// care about the size of your taskbar. The result of this is that panels that
// are auto_located on your screen suddenly run off the screen even with plenty of
// space around them.
Function GUIScreen_Size For Desktop Returns Integer
Local Integer iTop iLeft iRight iBottom bSuccess iHeight iWidth iSize
Local String sRect
Local Pointer lpsRect
ZeroType tRect To sRect
GetAddress of sRect To lpsRect
Move (vWin32_SystemParametersInfo(vSPI_GETWORKAREA, 0, lpsRect, 0)) To bSuccess
If bSuccess Begin
GetBuff From sRect At tRect.top to iTop
GetBuff From sRect At tRect.left to iLeft
GetBuff From sRect At tRect.bottom to iBottom
GetBuff From sRect At tRect.right to iRight
Move (iBottom - iTop) To iHeight
Move (iRight - iLeft) To iWidth
End
Function_Return ((iHeight*65536) + iWidth)
End_Function // GUIScreen_Size
While I have this code in my dfallent for your convience this package has been put in a
file called vAutoLocateFix.pkg (Netscape users:
Press the shift-key while clicking on the link). Following is some code of how to
include this in the order entry workspace example.
Object ProgramWorkspace is a Workspace
Set WorkspaceName to CURRENT$WORKSPACE
Set ModuleName to 'Order'
Set HelpName to 'OrdEntry.hlp'
End_Object
Use Help_Ids.inc // Developer should provide this file of help context links.
Use Std_Help.pkg
Use vAutoLocateFix.pkg // <=== this is it
/* DO NOT REMOVE THIS LINE: IDE GENERATED CODE WILL GO HERE */
Start_UI
This code is tested on windows 98 and NT4.