Mobile: Convert from screen to card coords

Mark Smith marksmithhfx at gmail.com
Tue Oct 18 09:12:13 EDT 2022


Hi Klaus, I don’t use fullscreen mode anymore. It’s much better looking if you position all of the controls yourself. Here’s an example that should get you started…

command layoutTheControls
   put safeAreaRect() into lSafeAreaRect -- the rect where it is safe to position all of the controls
    
   -- position the header bar
   set the width of widget "Header Bar" to item 3 of lSafeAreaRect -- right
   set the top of widget "Header Bar" to item 2 of lSafeAreaRect
   set the left of widget "Header Bar" to 0
   
    -- position the nav bar group  
   set the width of group "NavBar" to item 3 of lSafeAreaRect -- right
   set the bottom of group "NavBar" to item 4 of lSafeAreaRect
   set the height of group "NavBar" to the height of widget "Navigation Bar"
   set the left of group "NavBar" to 0
   
   -- position the navigation bar (inside the group)  
   set the width of widget "Navigation Bar" to the width of group "NavBar" -- right
   set the bottom of widget "Navigation Bar" to the bottom of group "NavBar"
   set the left of widget "Navigation Bar" to the left of group "NavBar"

     -- everything else gets positioned relative to lSafeAreaRect and other objects on the page
   -- for example, lets say you have a group you want to position below the header bar that is full width

   put 1961522 into tID
   set the width of group id tID to item 3 of lSafeAreaRect -- right
   set the height of group id tID to 44
   set the top of group id tID to the bottom of widget "Header Bar" + 6
   set the left of group id tID to 12

etc, until all the objects on the page are positioned. Then test on various simulated iPhones to see how it is working
and adjust as necessary.


> On Oct 18, 2022, at 1:55 PM, Klaus major-k via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Hi Brian,
> 
> I knew I forgot something...
> 
>> Am 17.10.2022 um 19:53 schrieb Brian Milby via use-livecode <use-livecode at lists.runrev.com>:
>> 
>> Looking at the image, I’m not sure you can do what you want and have it work.  You can draw outside of the card rect, but you can’t interact with anything outside of the rect.   In the image on the right, the nav bar is as low as it can go and receive touch interactions.
> 
> OK, I definitively understand that!
> 
> But iPhoneSafeArealnsets0 will only return values in SCREEN-coordinates 
> and I have no idea how to „convert" these to CARD coordinates.
> 
> We need that to move the bottom/top controls up or down if neccessary, 
> know what I mean? Any hints very welcome!
> 
>> ...
>> Brian Milby
> 
> Best
> 
> Klaus
> 
> --
> Klaus Major
> https://www.major-k.de
> https://www.major-k.de/bass
> klaus at major-k.de
> 
> 
> _______________________________________________
> 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