Page 1 of 1

effective working screenRect

Posted: Tue Aug 26, 2014 12:45 pm
by sims
When I add the following to my app I get the same results (0,0,640,704) for each.
Not helpful.

How do i get the loc top of the keyboard (in 3.5, 4, and iPad sizes) so i can properly move fields out of the way of the keyboard?


on keyboardActivated
    answer "keyboard activated" & cr & the effective working screenRect
end keyboardActivated

on keyboardDeactivated
    answer "keyboard deactivated" & cr & the effective working screenRect
end keyboardDeactivated

Re: effective working screenRect

Posted: Wed Aug 27, 2014 8:17 am
by Mark
Hi SIms,

Isn't the working screenRect updated after keyboardActivated handler finishes? Try

Code: Select all

on keyboardActivated
    send "keyboardActivated2" to me in 0 millisecs
end keyboardActivated

on keyboardActivated2
    answer "keyboard activated" & cr & the effective working screenRect
end keyboardActivated2
I wonder if "effective" is necessary. I haven't tried that.

Kind regards,

Mark

Re: effective working screenRect

Posted: Wed Aug 27, 2014 8:46 am
by sims
Thank you for the reply Mark.

Using your suggestion i get the same numbers as with my previous code "0,0,640,704"
I get different numbers for different devices but none of them seem to reflect the working screenrect or the top of the keyboard.
The stack is 320 x 480 in size - it must work for 3.5, 4.0, and iPad Retina displays

The preOpenStack includes:
iphoneUseDeviceResolution true, true
set the fullscreenmode of me to "noBorder"
set the acceleratedrendering of me to true

The field in question will need a different rect/loc (i am using "set the bottom of" to reposition) for each device so i am hoping the advertised scripts will do the job.
Setting the loc of each field for each device is an option but not a very attractive on due to the amount of flds.

Have you used these handlers to reposition fields with any success?

Thank you.
sims

Re: effective working screenRect

Posted: Wed Aug 27, 2014 6:57 pm
by Simon
Hi sims,
I think keyboardActivated/Deactivated is flaky, I think when you use the soft keyboard down (hide the keyboard from the keyboard keys) it does not trigger a keyboardDeactivated. At least that was my experience about a year ago, might have changed since then.
Also I believe the send should not be in 0 but more like 250 ms to allow the keyboard to finish moving into it's final position.

Simon

Re: effective working screenRect

Posted: Wed Aug 27, 2014 7:01 pm
by Mark
Hi,

Simon may be hitting the nail... I remember doing something like this and maybe I used send in 250 millisecs or perhaps even more.

Best,

Mark

Re: effective working screenRect

Posted: Thu Aug 28, 2014 10:34 am
by sims
Flaky it seems. Seems like such an essential thing as moving bits around can be a hack otherwise.
Add multiple devices and fullscreenmode it seems even more of a series of guesses.

Such is life.

Thanks for the replies.
sims