effective working screenRect

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
sims
Posts: 43
Joined: Wed Apr 12, 2006 5:36 pm

effective working screenRect

Post by sims » Tue Aug 26, 2014 12:45 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: effective working screenRect

Post by Mark » Wed Aug 27, 2014 8:17 am

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

sims
Posts: 43
Joined: Wed Apr 12, 2006 5:36 pm

Re: effective working screenRect

Post by sims » Wed Aug 27, 2014 8:46 am

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: effective working screenRect

Post by Simon » Wed Aug 27, 2014 6:57 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: effective working screenRect

Post by Mark » Wed Aug 27, 2014 7:01 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

sims
Posts: 43
Joined: Wed Apr 12, 2006 5:36 pm

Re: effective working screenRect

Post by sims » Thu Aug 28, 2014 10:34 am

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

Post Reply