From 5d90529c951381dc694db3995a7c7bf12c28030d Mon Sep 17 00:00:00 2001 From: patrick poly Date: Mon, 23 Sep 2024 13:18:57 +0200 Subject: [PATCH] ACI0105052 --- Project/Sources/Methods/Compiler_Methods.4dm | 9 +++- .../Methods/DatePicker Display Dialog.4dm | 15 +----- .../Sources/Methods/Tool_AdjustWindowPos.4dm | 50 +++++++++++++++++++ .../Methods/Tool_ScreenInfoFromPoint.4dm | 18 +++++++ 4 files changed, 77 insertions(+), 15 deletions(-) create mode 100644 Project/Sources/Methods/Tool_AdjustWindowPos.4dm create mode 100644 Project/Sources/Methods/Tool_ScreenInfoFromPoint.4dm diff --git a/Project/Sources/Methods/Compiler_Methods.4dm b/Project/Sources/Methods/Compiler_Methods.4dm index 393a3ba..7e2d2e8 100644 --- a/Project/Sources/Methods/Compiler_Methods.4dm +++ b/Project/Sources/Methods/Compiler_Methods.4dm @@ -125,4 +125,11 @@ C_TEXT:C284(SearchPicker__SET_TEXT; $1) C_TEXT:C284(SearchPicker__SET_TEXT; $2) C_TEXT:C284(TimePicker APPLY DEFAULT VALUES; $1) C_DATE:C307(DatePicker__CalculateFirstDay; $1) -C_TEXT:C284(DatePicker__CalculateFirstDay; $2) \ No newline at end of file +C_TEXT:C284(DatePicker__CalculateFirstDay; $2) +C_POINTER:C301(Tool_AdjustWindowPos; $1) +C_POINTER:C301(Tool_AdjustWindowPos; $2) +C_LONGINT:C283(Tool_AdjustWindowPos; $3) +C_LONGINT:C283(Tool_AdjustWindowPos; $4) +C_OBJECT:C1216(Tool_ScreenInfoFromPoint; $0) +C_LONGINT:C283(Tool_ScreenInfoFromPoint; $1) +C_LONGINT:C283(Tool_ScreenInfoFromPoint; $2) \ No newline at end of file diff --git a/Project/Sources/Methods/DatePicker Display Dialog.4dm b/Project/Sources/Methods/DatePicker Display Dialog.4dm index d8c692a..7c967f3 100644 --- a/Project/Sources/Methods/DatePicker Display Dialog.4dm +++ b/Project/Sources/Methods/DatePicker Display Dialog.4dm @@ -61,20 +61,7 @@ If ($CalcXY=True:C214) End if -Case of - : (($x1+$Width)>Screen width:C187) // Screen on MAC, MDI window on WIN - $x1:=Screen width:C187-$Width-5 - : ($x1<5) - $x1:=5 -End case - -Case of - : (($y1+$Height)>Screen height:C188) - $y1:=Screen height:C188-$Height-10 - : ($y1<5) - $y1:=5 -End case - +Tool_AdjustWindowPos(->$x1; ->$y1; $Width; $Height) $form:=New object:C1471 //ACI0099621 //ACI0099964 If (Count parameters:C259>=3) diff --git a/Project/Sources/Methods/Tool_AdjustWindowPos.4dm b/Project/Sources/Methods/Tool_AdjustWindowPos.4dm new file mode 100644 index 0000000..ae00325 --- /dev/null +++ b/Project/Sources/Methods/Tool_AdjustWindowPos.4dm @@ -0,0 +1,50 @@ +//%attributes = {"invisible":true} +#DECLARE($ioPosX : Pointer; $ioPosY : Pointer; $inWidth : Integer; $inHeight : Integer) + +var $applicationInfo : Object +var $inModalDialog : Boolean +var $x; $y : Integer +var $screenInfo : Object + +$screenInfo:={x: 0; y: 0; width: Screen width:C187; height: Screen height:C188} + +$x:=$ioPosX-> +$y:=$ioPosY-> + +If (Is Windows:C1573) + $applicationInfo:=Application info:C1599 + $inModalDialog:=(Window kind:C445(Frontmost window:C447)=Modal dialog:K27:2) + + If ($applicationInfo.SDIMode=False:C215 & $inModalDialog) + CONVERT COORDINATES:C1365($x; $x; XY Main window:K27:8; XY Screen:K27:7) + End if + + If ($applicationInfo.SDIMode=True:C214 | $inModalDialog) + $screenInfo:=Tool_ScreenInfoFromPoint($x; $y) + End if +Else + $screenInfo:=Tool_ScreenInfoFromPoint($x; $y) +End if + +Case of + : (($x+$inWidth)>($screenInfo.x+$screenInfo.width)) + $x:=($screenInfo.x+$screenInfo.width)-$inWidth-5 + : ($x<($screenInfo.x+5)) + $x:=$screenInfo.x+5 +End case + +Case of + : (($y+$inHeight)>($screenInfo.y+$screenInfo.height)) + $y:=($screenInfo.y+$screenInfo.height)-$inHeight-10 + : ($y<($screenInfo.y+5)) + $y:=$screenInfo.y+5 +End case + +If (Is Windows:C1573) + If ($applicationInfo.SDIMode=False:C215 & $inModalDialog) + CONVERT COORDINATES:C1365($x; $x; XY Screen:K27:7; XY Main window:K27:8) + End if +End if + +$ioPosX->:=$x +$ioPosY->:=$y \ No newline at end of file diff --git a/Project/Sources/Methods/Tool_ScreenInfoFromPoint.4dm b/Project/Sources/Methods/Tool_ScreenInfoFromPoint.4dm new file mode 100644 index 0000000..bebd36f --- /dev/null +++ b/Project/Sources/Methods/Tool_ScreenInfoFromPoint.4dm @@ -0,0 +1,18 @@ +//%attributes = {"invisible":true} +#DECLARE($inPosX : Integer; $inPosY : Integer)->$result : Object +var $screenCount; $screenIndex : Integer +var $left; $top; $right; $bottom : Integer + +$result:=New object:C1471("x"; 0; "y"; 0; "width"; Screen width:C187; "height"; Screen height:C188) + +$screenCount:=Count screens:C437 +For ($screenIndex; 1; $screenCount) + SCREEN COORDINATES:C438($left; $top; $right; $bottom; $screenIndex; Screen work area:K27:10) + If (($inPosX>=$left) & ($inPosX<$right) & ($inPosY>=$top) & ($inPosY<$bottom)) + $result.x:=$left + $result.y:=$top + $result.width:=$right-$left + $result.height:=$bottom-$top + break + End if +End for