Scroller And Keyboard

This is the place to discuss anything relating to MobGUI

Moderators: heatherlaine, kevinmiller, robinmiller, malte, splash21

Post Reply
Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Scroller And Keyboard

Post by Mikey » Fri Nov 25, 2011 4:23 pm

OK, I'm THIS close to having one of my prototypes ready to go BUT, I have a problem.

I have several text fields on a card, toward the bottom. When the keyboard pops up, those fields are covered.

I'm assuming I would use a scroller....somehow....to address this but
a) What all would I put in the scroller? Do I include the NavBar and all the labels and fields and buttons? What about the background?
b) Do I just Edit Group on the scroller and start dragging interface elements from MG into the group?
c) When the keyboard pops up I want to catch keyboardActivated in the card, right? Is that the way to handle this situation?
d) What properties of the scroller can I set? I would think I would first have to move the entire group and then set the vertical scroll to something, but since this is a MG control and I don't see the appropriate custom properties anywhere, I'm not sure what I am supposed to touch and what I am supposed to leave alone.

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

Re: Scroller And Keyboard

Post by Mark » Fri Nov 25, 2011 4:54 pm

Hi Mikey,

You may or may not have to use a scroller, but the first solution to this problem is to create another card with a field in the top part of the card. Go to this card whenever you need the user to enter text. This way, your field is always in the right place. Once the user finishes entering text, go back to the previous card and put the text where you need it. Of course, you can add a scroller to this field if the user needs to enter multiple lines. Make sure that you adjust the properties of the scroller as the formattedHeight of the field changes. Read the release note for iOS included with LiveCode.

In a few cases, I changed the location of objects dynamically, but it is probably easier and more beautiful to have a specially designed card for this.

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

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Scroller And Keyboard

Post by Mikey » Fri Nov 25, 2011 10:13 pm

Unfortunately, there are 7 fields on the card, so having a card for each is not an option, but thanks for the suggestion.

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

Re: Scroller And Keyboard

Post by Mark » Fri Nov 25, 2011 10:20 pm

Hi Mikey,

Yes, it IS an option. You won't have one card for each field. You will have one card for all fields. When you open the card, you will be editing only one field. When you press the Next or Go button on the keyboard, a script will put the text into the right field and you change currently edited field to #2 etc. It is not as difficult as you might think. You might also want to show a label above the editable field, to indicate which field is currently being edited.

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

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Scroller And Keyboard

Post by Mikey » Fri Nov 25, 2011 10:51 pm

Mark,

I appreciate the idea, and I understand how to implement it. However, the user needs to be able to see the other fields while typing into the one they are in. This is similar to the way the calendar works when you are entering an event - the scroll is on the current field, but the user is able to scroll up while the field still has the focus to see the other values.

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

Re: Scroller And Keyboard

Post by Mark » Fri Nov 25, 2011 11:40 pm

Hi Mikey,

You could group the fields and make the group scroll with a UIScrollView. That's how the calendar does it.

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

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Scroller And Keyboard

Post by Mikey » Sat Nov 26, 2011 3:44 am

There is still the matter of dealing with the keyboard. So back to my original question,

a) What all would I put in the scroller? Do I include the NavBar and all the labels and fields and buttons? What about the background?
b) Do I just Edit Group on the scroller and start dragging interface elements from MG into the group?
c) When the keyboard pops up I want to catch keyboardActivated in the card, right? Is that the way to handle this situation?
d) What properties of the scroller can I set? I would think I would first have to move the entire group and then set the vertical scroll to something, but since this is a MG control and I don't see the appropriate custom properties anywhere, I'm not sure what I am supposed to touch and what I am supposed to leave alone.

Post Reply

Return to “MobGUI”