How to move everything
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
How to move everything
Hey all
I'm currently making an app for work, and it's going to be released probably on iOS. Now, one of the few issues I've got to sort out is the matter of the soft keyboard. I'm testing it out on my Android, and when I do, the keyboard covers some of the fields. I've made an app before where I just grouped everything and had it all move up by the amount the keyboard stuck out, but the issue is I've got different cards with buttons and fields being created depending on what the user chooses, so I was hoping there would be a way to just say "move everything up 200", or something along those lines?
If there any other way to make everything move when the keyboard is enabled (I thought I remembered reading something about this a few months ago, but I had another look and couldn't find it again), that would be appreciated
Thanks in advanced
I'm currently making an app for work, and it's going to be released probably on iOS. Now, one of the few issues I've got to sort out is the matter of the soft keyboard. I'm testing it out on my Android, and when I do, the keyboard covers some of the fields. I've made an app before where I just grouped everything and had it all move up by the amount the keyboard stuck out, but the issue is I've got different cards with buttons and fields being created depending on what the user chooses, so I was hoping there would be a way to just say "move everything up 200", or something along those lines?
If there any other way to make everything move when the keyboard is enabled (I thought I remembered reading something about this a few months ago, but I had another look and couldn't find it again), that would be appreciated
Thanks in advanced
Re: How to move everything
Someone had exactly the opposite problem, I'm sure htis will help you, too
http://forums.livecode.com/viewtopic.php?f=53&t=26721
On the other hand, you can always group everything on a card and move that group!
http://forums.livecode.com/viewtopic.php?f=53&t=26721
On the other hand, you can always group everything on a card and move that group!
Re: How to move everything
Hi KlausKlaus wrote:Someone had exactly the opposite problem, I'm sure htis will help you, too
http://forums.livecode.com/viewtopic.php?f=53&t=26721
On the other hand, you can always group everything on a card and move that group!
Thanks for the tip! The only issue with this is that I read somewhere that acceleratedRendering doesn't work on iOS, only Android, so it would be useless to my bosses who only use iOS I think? Or does it work for iOS and I just read something and got it confused with something else?
Edit: Also an issue with acceleratedRendering I just remembered is that if I've got a field near the top of my stack, and I go to edit it, it moves up off the screen when the keyboard opens ! The complete opposite to what I want ! **end edit**
As for grouping - I've used that method before, and it worked well, but on this app, depending on what the user clicks, new buttons get added and deleted all the time, so I can't make everything a group in the first place. However, is there a way to group everything visible on the screen at once, then ungroup everything when the keyboard deactivates?
Many thanks
Michael
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: How to move everything
Hi Michael,
acceleratedRendering does work on iOS, just the card doesn't move up when the keyboard comes up like it does on Android.
Yes, grouping is the answer I've used.
Simon
acceleratedRendering does work on iOS, just the card doesn't move up when the keyboard comes up like it does on Android.
Yes, grouping is the answer I've used.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: How to move everything
Hi Michael,
sorry for my false information, but I confess that I am quite ignorant
when it comes to mobile stuff
Best
Klaus
sorry for my false information, but I confess that I am quite ignorant
when it comes to mobile stuff
Best
Klaus
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: How to move everything
Why do you want to move everything on the screen. Can't you just move the control that's under the keyboard?
- Attachments
-
- Move Input Control.zip
- (2.17 KiB) Downloaded 176 times
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: How to move everything
Thanks for the replies everyone! So, Simon - acceleratedRendering does work on iOS, but it doesn't make the fields move out of the way? And Tom - in truth, I just don't know how to move the one field and make it not overlap things and still look good . Because each section of the app has different fields and buttons, it wouldn't be a universal position, which is the only issue I'm having (my bosses want it to look nice and all that, which is why I thought of moving everything)
So if grouping is the way to go, how do I group everything on the screen, then ungroup it when it's done? The only way I know how to do it now is by setting the selected of everything to true, then using the group command, but that doesn't let me name the group so I can ungroup it later, does it? I know I can use create group "GroupName", but that doesn't group what's selected ! Surely there's a way I'm missing here?
So if grouping is the way to go, how do I group everything on the screen, then ungroup it when it's done? The only way I know how to do it now is by setting the selected of everything to true, then using the group command, but that doesn't let me name the group so I can ungroup it later, does it? I know I can use create group "GroupName", but that doesn't group what's selected ! Surely there's a way I'm missing here?
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: How to move everything
Hi Michael,
Have you tried "last"
Simon
Have you tried "last"
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: How to move everything
This is why I love Livecode! There's so many cool things you can do with it!
So, basically when the keyboard is activated, I want to first check if a field is being covered by it, and if it is, select everything and group it. Then when the keyboard is deactivated, I just use ungroup last group? Or am I missing something with the code? Because I just gave it a shot and it ungrouped a completed different group
So, basically when the keyboard is activated, I want to first check if a field is being covered by it, and if it is, select everything and group it. Then when the keyboard is deactivated, I just use ungroup last group? Or am I missing something with the code? Because I just gave it a shot and it ungrouped a completed different group
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: How to move everything
Rats! Should have been easy.
"Last whatever" is the highest layer control of type "whatever". I guess that when one groups it doesn't send it to the "layer top".
Hey... the dictionary says it should work.
"Last whatever" is the highest layer control of type "whatever". I guess that when one groups it doesn't send it to the "layer top".
Hey... the dictionary says it should work.
SimonTip: To refer to the newly-created group, use the last keyword:
group button "Yes" and button "No"
set the name of last group to "Do It"
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: How to move everything
Ah, right! I did some digging, and turns out the group that it ungrouped was layer 124, and the newly created group was layer 99 ish . Maybe the dictionary's example doesn't have multiple groups lying around ?
So, if I can't use the last command when I create a group, what can I do instead? I really wish there was a command that would let me name groups as I created them . That would be perfect!
So, if I can't use the last command when I create a group, what can I do instead? I really wish there was a command that would let me name groups as I created them . That would be perfect!
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: How to move everything
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: How to move everything
If you know the name or id of at least one of the controls in the new group, you can get the owner of that control, which will tell you the id of the group.
Edit:
Here's another way. Put this into the script:
When your script creates the group, the local script variable will contain its id. Your handler can read that value and ungroup it later. You should probably empty the variable after that to be safe.
Edit:
Here's another way. Put this into the script:
Code: Select all
local sCurGrp
on newGroup
put the name of the target into sCurGrp
end newGroup
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: How to move everything
Hi Jacque
So, just to confirm (and to make sure I actually understand rather than just copy your code ), when a new group is created in any way (from the group command for example), it will trigger the newGroup, which in this case will put the name of the group (because of the target part of the script) into a variable I can then use to go "ungroup sCurGrp" when the keyboard is activated? Seems simple enough !
Now just to fix a kinda major issue I'm having with my app where Livecode doesn't think it exists, then I'll test it out ! Thanks so much for your help
So, just to confirm (and to make sure I actually understand rather than just copy your code ), when a new group is created in any way (from the group command for example), it will trigger the newGroup, which in this case will put the name of the group (because of the target part of the script) into a variable I can then use to go "ungroup sCurGrp" when the keyboard is activated? Seems simple enough !
Now just to fix a kinda major issue I'm having with my app where Livecode doesn't think it exists, then I'll test it out ! Thanks so much for your help
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: How to move everything
Yes, exactly right. You've got it. Make sure you place the script local variable declaration above any handler that uses it. Generally it's located at the top of the script to be safe.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com