Someone loves overcomplicating things.

I don't, most of the time.

I just ran up a stack with 2 scrolling text fields called "VIDZ" and :VIDZ2" repectively, so that relative screen middles could go in the first one and absolute screen middles
in the second one, and then popped this code in a button:

on mouseUp
   put empty into fld "VIDZ"
   put empty into fld "VIDZ2"
   put the screenRects into fld "VIDZ"
   put 1 into VDUZ
   repeat until line VDUZ of fld "VIDZ" is empty
      put item 1 of line VDUZ of fld "VIDZ" into VW1
      put item 3 of line VDUZ of fld "VIDZ" into VW2
      put ((VW2-VW1)/2) into WIDD
      put (((VW2-VW1)/2)+VW1) into WIDD2
      put item 2 of line VDUZ of fld "VIDZ" into VH1
      put item 4 of line VDUZ of fld "VIDZ" into VH2
      put ((VH2-VH1)/2) into HITE
      put (((VH2-VH1)/2)+VH1) into HITE2
      put " screen centre at" && WIDD & "," && HITE after line VDUZ of fld "VIDZ"       put " screen centre at" && WIDD2 & "," && HITE2 after line VDUZ of fld "VIDZ2"
      add 1 to VDUZ
   end repeat
end mouseUp

I'll try to post the stack to the Forums, but my ISP is currently playing "silly buggers" so I cannot guarantee anything.

Richmond.

On 26.09.2018 17:37, Bob Sneidar via use-livecode wrote:
Or you could use the recent line intersect function recently posted by Richmond 
on the top,left bottom,right and bottom,left and top,right of your chosen 
monitor and round the results:

http://forums.livecode.com/viewtopic.php?f=7&t=31565

Bob S


On Sep 25, 2018, at 18:57 , Nicolas Cueto via use-livecode 
<use-livecode@lists.runrev.com> wrote:

Thank you, Paul.

Using "screenrects" as Paul suggested, here, for future reference, is a
script snippet that places a stack on the right monitor:

put the screenrects into tScrRects
if the environment is "development" and the number of lines in tScrRects >
1 then
      -- CENTRE THE STACK ON THE RIGHT MONITOR
      put line 2 of tScrRects into tRMon -- right monitor rect
      put ((item 3 of tRMon - item 1 of tRMon) / 2 + item 1 of tRMon) &
comma & \
            ((item 4 of tRMon - item 2 of tRMon) / 2) into tRect
      set the loc of this stack to tRect
   else
      -- CENTRE THE STACK ON TE LEFT MONITOR
      set the loc of this stack to the screenloc
   end if
--
Nicolas Cueto

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to