Sorry, it appears I attached the wrong link. Hopefully this one works better!!

https://www.dropbox.com/s/2igqdbroxy5onf7/Test%20Layout%2013.livecode.zip?dl=0 
<https://www.dropbox.com/s/2igqdbroxy5onf7/Test%20Layout%2013.livecode.zip?dl=0>



> On Feb 10, 2022, at 10:08 PM, Mark Smith <marksmith...@gmail.com> wrote:
> 
> Hello everyone, 
> 
> Once again thanks to the many of you who provided advice and suggestions. 
> They were really very helpful in coding up this full working example. In the 
> interests of sharing I have posted an example into a dropbox account, and 
> will upload a copy to the forums at some point. This example takes a “dummy” 
> layout of my Organize app (nothing is being saved, most features are not 
> included) and redraws the main screen to fit the target device using just 
> iPhoneSafeAreaInsets() and "the effective working screenRect" and nothing 
> else (no fullscreenmode for example). It works remarkably well. I have tested 
> it on a physical SE, 6S, 11, 12 and 13 mini and it adapts to each screen as 
> you would expect. It is remarkably satisfying to see it adapt to changes in 
> the keyboard size (predictive, not predictive) on the fly. No special code 
> was required to do this. 
> 
> You’ll need to compile the example for iPhone and use a developer profile to 
> install it on an iPhone device. The simulator does not really provide a 
> useful simulation primarily because it does not simulate the behaviour of the 
> keyboard very well (however, if you just want to see how the layout adapts, 
> it is perfectly fine for that). Its possible I have not developed the most 
> efficient method of coding the layout. If you have any suggestions, I’d be 
> most grateful to receive them.
> 
> UI tips:
> 1. tapping once on white space below the dg entries dismisses the keyboard 
> (so does the “down arrow” when it appears in the header bar).
> 2. tapping twice adds a new blank line (or inserts the cursor into an 
> existing one) (so does the “+” sign in the header bar).
> 
> The rest should be obvious, I hope. All of the layout is in the card script. 
> All of the dg code is in the dg handler and behavior script. 
> Finally, if you have any questions, please feel free to send them on.
> 
> All the best,
> Mark
> 
> https://www.dropbox.com/s/nmri0dy5j5qtc8c/test.livecode.zip?dl=0 
> <https://www.dropbox.com/s/nmri0dy5j5qtc8c/test.livecode.zip?dl=0>
> 
> 
> 
>> On Dec 27, 2021, at 12:05 PM, Mark Smith <marksmith...@gmail.com 
>> <mailto:marksmith...@gmail.com>> wrote:
>> 
>> Thank you Sean and Jacque, 
>> 
>> I’ve not had a chance to work on a complete solution but thought I would 
>> make a test run to see what “the effective working screenrect” was returning 
>> and as the following indicates, it does in fact take into consideration the 
>> keyboard. I just coded up one line to  run whenever the status of the 
>> keyboard changed and tried it both with and without the “predictive” option 
>> turned on. As you can see, it was very sensitive to this change…
>> 
>> without predictive:
>> 
>> 9:37:14 PM keyboardActivated 0,0,375,451
>> 9:37:15 PM keyboardDeactivated 0,0,375,667
>> 9:37:18 PM keyboardActivated 0,0,375,451
>> 9:37:19 PM keyboardDeactivated 0,0,375,667
>> 9:37:19 PM keyboardActivated 0,0,375,451
>> 9:37:23 PM keyboardDeactivated 0,0,375,667
>> 
>> 
>> with predictive: 
>> 
>> 9:56:54 PM keyboardActivated 0,0,375,407
>> 9:56:55 PM keyboardDeactivated 0,0,375,667
>> 9:56:55 PM keyboardActivated 0,0,375,407
>> 9:56:57 PM keyboardDeactivated 0,0,375,667
>> 
>> In my particular case not all 4 value are immediately useful. For example, I 
>> have a fixed header and footer that need to be accommodated so the correct 
>> “useable” rect for me is:
>> 
>> 0,69, 377, 618 (for no predictive)
>> 0,69,377,456 ( for predictive)
>> 
>> but this can easily be accommodated since the header/footer values don’t 
>> change. The beauty is I now have a rect lower bound (ie. keyboard height) 
>> that actually reflects where the keyboard is. 
>> 
>> Brilliant!! Thank you both,
>> 
>> Mark
>> 
>> Sean, I tried iPhoneSafeAreaInsets() but it appears it returns a constant 
>> set of values regardless of keyboard position on my iPhone 12
>> 
>> 11:51:22 AM keyboardActivated 0,47,0,34
>> 11:51:22 AM keyboardDeactivated 0,47,0,34
>> 11:51:26 AM keyboardActivated 0,47,0,34
>> 11:51:26 AM keyboardDeactivated 0,47,0,34
>> 
>> And didn’t change when I added / subtracted “predictive”. So, just the 
>> available usable space at the top and bottom of the screen. I haven’t 
>> adjusted my app yet to fully take advantage of the larger screen on a 12 (it 
>> was developed on a 6S) but when I get to more response design this will be 
>> useful to know where the usable top and bottom are. 
>> 
>> Cheers!!
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> On Dec 25, 2021, at 5:25 PM, Sean Cole via use-livecode 
>>> <use-livecode@lists.runrev.com <mailto:use-livecode@lists.runrev.com>> 
>>> wrote:
>>> 
>>> Another addendum to this I just noticed is in the latest RC, LC9.6.6RC1,
>>> which has iphoneSafeAreaInsets for discerning the safe area from furniture
>>> like the notch and so on. I haven't tested this but that may also include
>>> things like the keyboard and predictive areas. I just thought it was worth
>>> a mention here.
>>> 
>>> Regards
>>> Sean
>>> 
>>> On Fri, 24 Dec 2021 at 20:44, J. Landman Gay via use-livecode <
>>> use-livecode@lists.runrev.com <mailto:use-livecode@lists.runrev.com>> wrote:
>>> 
>>>> On 12/24/21 2:16 PM, Sean Cole via use-livecode wrote:
>>>>> Just adding to what Jacquie wrote, there is also the effective working
>>>>> screenrect.
>>>> 
>>>> You're right, "effective" was added to account for the keyboard on mobile.
>>>> I'd start with that.
>>>> 
>>>> --
>>>> Jacqueline Landman Gay         |     jac...@hyperactivesw.com 
>>>> <mailto:jac...@hyperactivesw.com>
>>>> HyperActive Software           |     http://www.hyperactivesw.com 
>>>> <http://www.hyperactivesw.com/>
>>>> 
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode@lists.runrev.com <mailto: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 
>>>> <http://lists.runrev.com/mailman/listinfo/use-livecode>
>>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com <mailto: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 
>>> <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