How to move everything

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

How to move everything

Post by Opaquer » Wed Mar 16, 2016 5:53 am

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 :)

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to move everything

Post by Klaus » Wed Mar 16, 2016 10:46 am

Someone had exactly the opposite problem, I'm sure htis will help you, too :D
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!

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: How to move everything

Post by Opaquer » Thu Mar 17, 2016 5:16 am

Klaus wrote:Someone had exactly the opposite problem, I'm sure htis will help you, too :D
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!
Hi Klaus :D

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 :P! The complete opposite to what I want :P! **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

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

Re: How to move everything

Post by Simon » Thu Mar 17, 2016 9:33 am

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

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to move everything

Post by Klaus » Thu Mar 17, 2016 9:43 am

Hi Michael,

sorry for my false information, but I confess that I am quite ignorant
when it comes to mobile stuff 8)


Best

Klaus

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: How to move everything

Post by quailcreek » Thu Mar 17, 2016 4:13 pm

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

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: How to move everything

Post by Opaquer » Fri Mar 18, 2016 12:32 am

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 :P. 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 :P! Surely there's a way I'm missing here?

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

Re: How to move everything

Post by Simon » Fri Mar 18, 2016 12:38 am

Hi Michael,
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!

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: How to move everything

Post by Opaquer » Fri Mar 18, 2016 12:42 am

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 :P

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

Re: How to move everything

Post by Simon » Fri Mar 18, 2016 12:57 am

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

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: How to move everything

Post by Opaquer » Fri Mar 18, 2016 1:12 am

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 :P?

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 :P. That would be perfect!

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

Re: How to move everything

Post by Simon » Fri Mar 18, 2016 10:46 am

I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to move everything

Post by jacque » Fri Mar 18, 2016 8:28 pm

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:

Code: Select all

local sCurGrp

on newGroup
  put the name of the target into sCurGrp
end newGroup
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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: How to move everything

Post by Opaquer » Mon Mar 21, 2016 5:15 am

Hi Jacque

So, just to confirm (and to make sure I actually understand rather than just copy your code :P), 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 :P!

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 :D! Thanks so much for your help :)

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to move everything

Post by jacque » Mon Mar 21, 2016 3:54 pm

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

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”