Page 1 of 1

Keyboard Interrupting openField Handler

Posted: Fri Mar 22, 2013 7:54 pm
by jstarkman
Hi LC Gurus...

I've run up against another challenge and hope somebody has some information or a solution that I'm missing.

I have a scrollGroup which has buttons and fields in it. When a field is selected on the lower half of the ipad (landscape) screen, the keyboard slides up and covers the fields.

I've created a handler to address this (pseudo code):

on openField
get the top of the selected field
if top of the field > 350 then # which is top of keyboard when open
put vScroll of scrollGroup into tCurrentScroll
calculate tDeltaScroll = top of field - 350
set the vScroll of scrollGroup to tCurrentScroll + tDeltaScroll
end if
end openField

The code I've written above works fine, however the action produces an abrupt vScroll motion (not attractive or elegant).
I've written my own decelerating vScroll like this (pseudo code, substituted for the 'set the vScroll' portion in the code above):

set the vScroll of scrollGroup to tCurrentScroll + tDeltaScroll * 0.80
wait 20 milliseconds
set the vScroll of scrollGroup to tCurrentScroll + tDeltaScroll * 0.90
wait 10 milliseconds
set the vScroll of scrollGroup to tCurrentScroll + tDeltaScroll * 0.95
wait 5 milliseconds
set the vScroll of scrollGroup to tCurrentScroll + tDeltaScroll * 0.98
wait 2 milliseconds

This code produces the desired effect when tested in a button handler. However when this code is inserted into the openField handler, the scrolling effect doesn't take place. It appears as if the wait commands don't interrupt the display of the keyboard, and once the keyboard is up, the openField handler is over.

Any ideas? I've tried adding a 'focus on nothing' at the top of openField in an attempt to prevent the early display of the keyboard.

Thanks,

Joel

Re: Keyboard Interrupting openField Handler

Posted: Sat Mar 23, 2013 1:23 am
by Simon
Hi Joel,
Have you tried it in the keyboardActivated message?

Simon

Re: Keyboard Interrupting openField Handler

Posted: Sat Mar 23, 2013 3:25 pm
by jstarkman
Hi Simon,

Have tried that but the behavior is the same. Have also tried different iPhoneSetRedrawInterval values.

Joel