rect w/ scaleFactor?

Ralph DiMola rdimola at evergreeninfo.net
Mon Feb 9 16:22:56 EST 2015


This is what I do.... There is a lot going on here. This function will allow
for the keyboard area. I set the pixelscale to 1 for all devices at startup.
I don't know if other scale factors will affect this function but all one
would need is some constructive multiplies.

function getCardRect
   
--If ignorekeyboard is true then the rect is the entire card is returned
--If ignorekeyboard is false then....
-- If ShrinkKeyboard is true then the rect of the available real-estate is
returned
-- If ShrinkKeyboard is false then the top of the rect is off screen but the
canvas size is the same if the keyboard was not there.
--  also in this mode the canvas can be shifted by KeyboardOffet pixels.

   local r1 , r2 , r3 , r4 , tR2 , tR4 , tRectTemp
   
   --return the rect of this card
   if the environment is not "mobile" then
      put item 1 of the rect of this card into R1
      put item 2 of the rect of this card into R2
      put item 3 of the rect of this card into R3
      put item 4 of the rect of this card into R4
   else -- Mobile
      put the screenrect into tRectTemp
      if the ignorekeyboard of this stack then
         put item 1 of the rect of this stack into R1
         put item 2 of the rect of this stack into R2
         put item 3 of the rect of this stack into R3
         put item 4 of the rect of this stack into R4
      else -- Don't Ignore Keyboard
         put 0 into R1
         put item 3 of the effective working screenrect - item 1 of the
effective working screenrect into R3
         if the ShrinkKeyboard of this stack then
            put 0 into R2
            put item 4 of the effective working screenrect - item 2 of the
effective working screenrect into R4
         else -- Shrink Keyboard
            put (item 4 of the effective working screenrect - item 2 of the
effective working screenrect) - item 4 of the rect of this stack into R2
            put item 4 of the effective working screenrect - item 2 of the
effective working screenrect into R4
            if the KeyboardOffet of this stack is not empty and the
KeyboardOffet of this stack is a number then
               put (item 2 of the rect of this stack - the KeyboardOffet of
this stack) into tR2
               put (item 4 of the rect of this stack - the KeyboardOffet of
this stack) into tR4
               if tR2 >= R2 then
                  put tR2 into R2
                  put tR4 into R4
               end if -- Offset out of range
            end if -- Keyboard Offset
         end if -- Shrink Keyboard
      end if --Ignore Keyboard
   end if -- Mobile
   return (R1,R2,R3,R4)
end getCardRect



Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net
-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
Of Richard Gaskin
Sent: Monday, February 09, 2015 3:53 PM
To: How to use LiveCode
Subject: rect w/ scaleFactor?

When the scaleFactor is set to any value other than 1, there appears to be
no relationship between the stack's rect property and its apparent rect on
screen.

"the effective rect..." doesn't help.

How can I obtain the actual on-screen rect of a stack whose scaleFactor is
set to any value other than 1?

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com

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





More information about the use-livecode mailing list