AlertLoc

FlexibleLearning at aol.com FlexibleLearning at aol.com
Wed Sep 7 08:57:50 EDT 2005


Window placement has caused some discussion recently, so I thought I'd  add 
my own ponderings to the pot...

on preOpenStack
  set the loc of this stack to alertLoc()
  checkWD
end preOpenStack
 

function alertLoc
if "Win32" is in the platform  then
if the mode of this stack is in "1,2" then put 30  into n # Toplevel titleBar 
height
else put 22 into n #  Palette, modeless and modal titlebar height
else
if the mode of this stack is in "1,2" then put 23 into n # Toplevel titleBar  
height
else put 16 into n # Palette, modeless and modal  titlebar height
end if
if the decorations of this stack =""  then put n-n into n
get the windowBoundingRect
put round(  (the width of this stack /2) + ((item 3 of it - item 1 of it) - 
the width of  this stack) / 2) + item 1 of it into x
put round( (the height of this  stack /2) + ((item 4 of it - item 2 of it) - 
the height of this stack +n) / 3) +  item 2 of it into y
return x,y
end alertLoc
 
on checkWD
  --| Ensure window is onScreen
set the top of this  stack to max(item 2 of the WindowBoundingRect,the top of 
this  stack)
set the right of this stack to min(item 3 of the  WindowBoundingRect,the 
right of this stack)
set the left of this stack  to max(item 1 of the WindowBoundingRect,the left 
of this stack)
set  the bottom of this stack to min(item 4 of the WindowBoundingRect,the 
bottom of  this stack)
end checkWD
 
/H



More information about the use-livecode mailing list