screenRect and screenLoc weirdness

Paul Dupuis paul at researchware.com
Tue Jan 15 07:12:44 EST 2019


On 1/14/2019 7:58 PM, Knapp Martin via use-livecode wrote:
>> set the loc of stack "Ask Dialog" to screenLoc()
>> ask "What color is you favorite?”
> Does that work for you Paul - it doesn’t for me. I’m having to do this:
>
> send CenterAnswerOnScreen to me in 1 tick
> answer “Blah blah blah”
>
> on CenterAnswerOnScreen
>     set the loc of stack "answer dialog" to the screenLoc
> end CenterAnswerOnScreen
>
> I have a couple of customers with small-screened laptops who use large secondary monitors aligned at the bottom. Thus the top of the secondary monitor is quite a bit above the main laptop monitor. Ask and Answer dialogs are so far off you can only see about the bottom 1/8 of an inch of the window and are thus unusable.
>
> Marty
>
>

Yes, it has been working for us. It works in LC9.0.2 with a new stack 
and a button with those 2 lines in a mouseUp handler.

I think this may only work under Desktop OSes as the Inclusions (in 
Standalone settings) show the standard Ask and Answer Dialogs available 
only for Linux, OSX, and WIndows.

Also, per prior discussion in this thread, code like:

set the loc of stack "Ask Dialog" to effectiveScreenLocOfScreen(the 
sceeen of this stack)
ask "What color?"

where

function effectiveScreenLocOfScreen pScreen
   -- pScreen is a monitor number (a line of the screenRects or the value of the screen of stack property
   --
   local tRect,tH,tV
   put line pScreen of the effective screenRects into tRect -- or use 'effective working screenRects' for accommodating pop up keyboards and such
   put ((item 3 of tRect - item 1 of tRect)/2) into tH
   put ((item 4 of tRect - item 2 of tRect)/2) into tV
   return (tH,tV)
end effectiveScreenLocOfScreen

should result in centering an Ask Dialog on the monitor that the stack that invokes it is on.





More information about the use-livecode mailing list