screenloc not actually centered after changing scalefactor (was Screen Resolution for Desktop Apps)

Nicolas Cueto niconiko at gmail.com
Wed Dec 27 22:19:49 EST 2017


Following upon Jacqueline's advice on the original thread, here is my stack
script for modifying scalefactor based on monitor screenrect differences
(i.e., between the monitor I developed the stack and other monitors):

///////////////////////////////////////////////////////////////
on preopenstack
   defaultStackAppearance
end preopenstack

on defaultStackAppearance
   lock screen
   set the fullscreen of this stack to false
   set the width of this stack to 1126
   set the height of this stack to 627

   -- Set to the lower of two screenrect-based ratios.
   -- On the monitor I developed this app,
   -- 1152 was item 3 (width) of the working screenrect and
   -- 682 was item 4 (height) of the working screenrect.

   put round((item 3 of the working screenrect) / 1152,2) into ratio_width
   put round((item 4 of the working screenrect) / 682,2) into ratio_height
   if ratio_width > ratio_height then
      -- current monitor is wider then devpt monitor, so set to height ratio
      set the scalefactor of this stack to ratio_height
   else
      -- current monitor is taller than devpt monitor, so set to width ratio
      set the scalefactor of this stack to ratio_width
   end if
   set the loc of this stack to the screenloc
   unlock screen
end defaultStackAppearance
///////////////////////////////////////////////////////////////

Problem is, after opening the standalone on different PCs the rescaling
fits the monitor, but the window is not centered despite the "set the loc
to screenloc" command.

Suggestions?

Thank you.

--
Nicolas Cueto



More information about the use-livecode mailing list