Hi All,
In order to make a “Sheets” like location on windows (so this cross-platform
app looks similar) I did the following:
If you use Kirk’s code as a starter (which is quite flexible) or your own then
all you need to do is to adjust a few properties.
On the Windows you can get a Sheet like look (positioned without the animation):
GET WINDOW RECT($left;$top;$right;$bottom;Frontmost window)
$midW:=($right-$left)/2
Window Type: Modal form dialog box (allows other modals to open on top of it)
padTop = 4
padLeft = $midW-($width/2)
I created a wrapper like so:
WIN_Sheet (506;587)
// Method: WIN_Sheet
C_LONGINT($1;$2;$w;$h)
C_LONGINT($winRef)
C_LONGINT($left;$top;$right;$bottom)
C_LONGINT($midW)
C_OBJECT($oWin)
$w:=$1
$h:=$2
If (Is Windows)
$oWin:=OB_new
GET WINDOW RECT($left;$top;$right;$bottom;$window)
$midW:=($right-$left)/2
OB SET($oWin;"window";Frontmost window)
OB SET($oWin;"width";$w)
OB SET($oWin;"height";$h)
OB SET($oWin;"padTop";4)
OB SET($oWin;"padLeft";$midW-($w/2))
OB SET($oWin;"title";"")
OB SET($oWin;"closeBox";"")
OB SET($oWin;"type";Modal form dialog box)
WIN_open_inCurrentWinByObj ($oWin)
Else
$winRef:=WN_Open_Centered ($w;$h;Sheet form window)
End if
Note: the modal window on the Mac can remain open and you can click into design
mode. On Windows "Modal form dialog box” window type must be closed to click
anywhere on the screen outside the modal window. So I am still searching to see
if an exact Macintosh Sheets window type exists on windows.
But it works pretty well! {Again minus the animation. Although if one were to
open a window in the top position of 1 pixel in height and then in a loop use
the SET WINDOW RECT by a fixed number of pixels in height (10, 20, 30, 50,
100…) one could simulate animation.}
Hope that helps someone else,
John...
> On Nov 20, 2019, at 12:10 PM, John J Foster <[email protected]> wrote:
>
> Hey Kirk,
>
> Thanks!
>
> I figured someone must have figured out the correct window type.
>
> Oh cool it looks localized as well?
>
> Appreciate,
> John…
>
>> Hey John,
>> This might help. You pass an object with the various params and it will
>> open a new window within the bounds of whatever window you call it in.
>> You can futz with the padding at the top to get it lined up the way you
>> want.
>> And looking at it it could be freshened up to dot notation...
>>
>> //%attributes = {}
>> // [ WIN_open_inCurrentWinByObj ]
>> // Written (OS): Kirk Brooks Created: 11/16/12, 15:41:56
>> // ------------------
>> // Method: WIN_open_inCurrentWinByObj (c-obj) -> longint
>> // $1 is c-obj of params:
>> // { window: 0, ` default is FrontMost
>> // width: 0, ` default is 3/4 window
>> // height: 0, ` default is 3/4 window
>> // type: 0, ` default is Modal form dialog box
>> // padTop, padLeft: pix spaced from top or left border
>> // title: "", ` window title
>> // closeBox: "", ` method to set for closebox
>> // Purpose: open a window within a window.
>> //
>>
>> C_OBJECT:C1216($1;$obj)
>> C_LONGINT:C283($0)
>> C_LONGINT:C283($left;$top;$right;$bottom;$height;$width;$type;$padTop;$padLeft;$window)
>> C_TEXT:C284($title;$closeBox)
>>
>> $obj:=OB_New
>> $obj:=$1
>>
>> // --------------------------------------------------------
>> If (OB Is defined:C1231($obj;"window"))
>> $window:=OB Get:C1224($obj;"window";Is longint:K8:6)
>> Else
>> $window:=Frontmost window:C447
>> End if
>>
>> GET WINDOW RECT:C443($left;$top;$right;$bottom;$window)
>>
>> // --------------------------------------------------------
>> $width:=OB Get:C1224($obj;"width";Is longint:K8:6)
>> If ($width=0)
>> $width:=($right-$left)*0.75
>> End if
>>
>> $height:=OB Get:C1224($obj;"height";Is longint:K8:6)
>> If ($height=0)
>> $height:=($bottom-$top)*0.75
>> End if
>>
>> If (OB Is defined:C1231($obj;"type"))
>> $type:=OB Get:C1224($obj;"type";Is longint:K8:6)
>> Else
>> $type:=Modal form dialog box:K39:7
>> End if
>>
>>
>> $padTop:=OB Get:C1224($obj;"padTop";Is longint:K8:6)
>> $padLeft:=OB Get:C1224($obj;"padLeft";Is longint:K8:6)
>>
>> If (OB Is defined:C1231($obj;"title"))
>> $title:=OB Get:C1224($obj;"title";Is text:K8:3)
>> End if
>>
>> If (OB Is defined:C1231($obj;"closeBox"))
>> $closeBox:=OB Get:C1224($obj;"closeBox";Is text:K8:3)
>> End if
>>
>> // --------------------------------------------------------
>> $top:=$top+$padTop
>> $left:=$left+$padLeft
>>
>> $right:=$left+$width
>> $bottom:=$top+$height
>>
>> // --------------------------------------------------------
>>
>> Case of
>> : ($type=Modal dialog:K27:2) | ($type=Modal dialog box:K34:2) |
>> ($type=Modal form dialog box:K39:7) | (($closeBox="") & ($title=""))
>> $0:=Open window:C153($left;$top;$right;$bottom;$type)
>> : ($closeBox="")
>> $0:=Open window:C153($left;$top;$right;$bottom;$type;$title)
>> Else
>> $0:=Open window:C153($left;$top;$right;$bottom;$type;$title;$closeBox)
>> End case
>
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************