Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Dialog Position Aero Right Hand Side Screen Border Dual Monitor Multi-Monitor Gap Pixel Dialog Unit WinMetrics SysParamInfo Work Area Resolution
;********************************************************************************** ; You have 3 things to configure in code: ; 1. Set MyDialogWidth & MyDialogHeight to the real dialog width & height ; 2. In your dialog change the dialogx and dialogy to = MyDialogX and = MyDialogY ; 3. Set the number to which corner to align the dialog to ;********************************************************************************** #DefineFunction LocateTaskBar() sWorkArea = SysParamInfo(48, "", 0) iResolutionX = WinMetrics(0) iResolutionY = WinMetrics(1) iLeft = ItemExtract(1, sWorkArea, ",") iTop = ItemExtract(2, sWorkArea, ",") iRight = ItemExtract(3, sWorkArea, ",") iBottom = ItemExtract(4, sWorkArea, ",") If iBottom <> iResolutionY iTBLocation = 0 ;"Bottom" EndIf If iLeft == 0 && iRight == iResolutionX && iBottom == iResolutionY iTBLocation = 1 ;"Top" EndIf If iTop == 0 && iRight == iResolutionX && iBottom == iResolutionY iTBLocation = 2 ;Left" EndIf If iBottom == iResolutionY && iRight <> iResolutionX && iBottom == iResolutionY iTBLocation = 3 ;"Right" EndIf ;This can be used to prove it. ;sText = StrCat("Work Area (L, T, R, B) = ", sWorkArea, @CRLF, "Task bar is on - ", iTBLocation, @CRLF) ;sText = StrCat(sText, "iLeft = ", iLeft, @CRLF) ;sText = StrCat(sText, "iTop = ", iTop, @CRLF) ;sText = StrCat(sText, "iRight = ", iRight, @CRLF) ;sText = StrCat(sText, "iBottom = ", iBottom, @CRLF) ;sText = StrCat(sText, "iResolutionX = ", iResolutionX, @CRLF) ;sText = StrCat(sText, "iResolutionY = ", iResolutionY, @CRLF) ;Message("", sText) Return iTBLocation #EndFunction ;Configure the params for the dialog location iPixelsPerHorizontalDU = WinMetrics(-6) iPixelsPerVerticalDU = WinMetrics(-5) iTBLocation = LocateTaskBar() iResolutionX = WinMetrics(0) iResolutionY = WinMetrics(1) sWorkArea = SysParamInfo(48, "", 0) iLeft = ItemExtract(1, sWorkArea, ",") iTop = ItemExtract(2, sWorkArea, ",") iRight = ItemExtract(3, sWorkArea, ",") iBottom = ItemExtract(4, sWorkArea, ",") iTitleBarHeight = WinMetrics(4) ;These params come from the dialog MyDialogWidth = 110 MyDialogHeight = 045 ; Align Window ; 0 = top left ; 1 = top right ; 2 = bottom right ; 3 = bottom left ; TBLocation ; 0 = Bottom ; 1 = Top ; 2 = Left ; 3 = Right iAlignDialog = 2 ;<--------- Change this to determine which corner to align to. Select iAlignDialog Case 0 ;Align to Top Left If iTBLocation == 0 || iTBLocation == 3 ; iTBLocation 0 is Bottom, iTBLocation 3 is Right MyDialogX = 0 MyDialogY = 0 EndIf If iTBLocation == 1 ;Top MyDialogX = 0 MyDialogY = Int(Floor(iTop/iPixelsPerVerticalDU)) EndIf If iTBLocation == 2;Left MyDialogX = Int(Floor(iLeft/iPixelsPerHorizontalDU)) MyDialogY = 0 EndIf Break Case 1 ;Align to Top Right If iTBLocation == 0 || iTBLocation == 2 ;0 - bottom, 2 Left MyDialogX = Int(Floor(iResolutionX/iPixelsPerHorizontalDU - MyDialogWidth)) MyDialogY = 0 EndIf If iTBLocation == 1 ;top MyDialogX = Int(Floor(iResolutionX/iPixelsPerHorizontalDU - MyDialogWidth)) MyDialogY = Int(Floor(iTop/iPixelsPerVerticalDU)) EndIf If iTBLocation == 3 ;Right MyDialogX = Int(Floor(iRight/iPixelsPerHorizontalDU - MyDialogWidth)) MyDialogY = 0 EndIf Break Case 2 ;Align to Bottom Right If iTBLocation == 0 ;Bottom MyDialogX = Int(Floor(iResolutionX/iPixelsPerHorizontalDU - MyDialogWidth)-5) ;****Needs the -5 offset for Aero*** MyDialogY = Int(Floor(iBottom/iPixelsPerVerticalDU - (MyDialogHeight+(iTitleBarHeight/iPixelsPerVerticalDU)))) EndIf If iTBLocation == 1 ;Top MyDialogX = Int(Floor(iResolutionX/iPixelsPerHorizontalDU - MyDialogWidth)) MyDialogY = Int(Floor(iBottom/iPixelsPerVerticalDU - (MyDialogHeight+(iTitleBarHeight/iPixelsPerVerticalDU)))) EndIf If iTBLocation == 2 ;Left MyDialogX = Int(Floor(iResolutionX/iPixelsPerHorizontalDU - MyDialogWidth)) MyDialogY = Int(Floor(iResolutionY/iPixelsPerVerticalDU - (MyDialogHeight+(iTitleBarHeight/iPixelsPerVerticalDU)))) EndIf If iTBLocation == 3 ;Right MyDialogX = Int(Floor(iRight/iPixelsPerHorizontalDU - MyDialogWidth)) MyDialogY = Int(Floor(iResolutionY/iPixelsPerVerticalDU - (MyDialogHeight+(iTitleBarHeight/iPixelsPerVerticalDU)))) EndIf Break Case 3 ;Align to Bottom Left If iTBLocation == 0 ;Bottom MyDialogX = 0 MyDialogY = Int(Floor(iBottom/iPixelsPerVerticalDU - (MyDialogHeight+(iTitleBarHeight/iPixelsPerVerticalDU)))) EndIf If iTBLocation == 1 || iTBLocation == 3 MyDialogX = 0 MyDialogY = Int(Floor(iResolutionY/iPixelsPerVerticalDU - (MyDialogHeight+(iTitleBarHeight/iPixelsPerVerticalDU)))) EndIf If iTBLocation == 2 ;Left MyDialogX = Int(Floor(iLeft/iPixelsPerHorizontalDU)) MyDialogY = Int(Floor(iResolutionY/iPixelsPerVerticalDU - (MyDialogHeight+(iTitleBarHeight/iPixelsPerVerticalDU)))) EndIf Break EndSelect MyDialogFormat=`WWWDLGED,6.1` MyDialogCaption=`WIL Dialog 1` MyDialogX=MyDialogX MyDialogY=MyDialogY MyDialogWidth=110 MyDialogHeight=045 MyDialogNumControls=001 MyDialogProcedure=`DEFAULT` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialogConfig=0 MyDialog001=`037,015,036,012,PUSHBUTTON,DEFAULT,"OK",1,1,32,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("MyDialog")
I have not tested the following enough to know if it would work in all cases but it might be a starting point for a generalized solution
;;; iPixelsPerHorizontalDU = WinMetrics(-6) nBordLine = WinMetrics(5) ; Border line thickness. nNoSize = WinMetrics(7) ; Non sizing border width. nSizable = WinMetrics(32); Sizing border width. ; For testing try nAeroAdj where the -5 is used. If (nBordLine+nNoSize) < nSizable nAeroAdj = (nSizable-nNoSize)/iPixelsPerHorizontalDU Else nAeroAdj = 0 EndIf
Article ID: W17711
Filename: Areo Window Borders Issue.txt
File Created: 2011:12:01:11:00:04
Last Updated: 2011:12:01:11:00:04