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

Re: How to move everything

Post by Opaquer » Tue Mar 29, 2016 6:51 am

Hey everyone. Again :(. I was hoping that I would have had good news by now, but I'm still struggling a lot with this :(.

So, I've got the keyboardActivated step working, and I've got it ready to group everything to move it. The only issue is that I've got it set up like this:

Code: Select all

on keyboardActivated
   repeat with i=1 to the number of controls of this card 
      set the selected of control i to true
   end repeat
   group
   repeat with i=1 to the number of controls of this card 
      set the selected of control i to false
   end repeat
end keyboardActivated
(plus a bit more where I've got it moving etc, just the basics). Now the first issue is that when everything gets selected and grouped and deselected, it gets rid of the keyboard :(. Is there a way I can do it and still keep the keyboard up?

The second issue is that for some reason, Jacque's advice doesn't work (even though the dictionary says it should), and doing on newGroup apparently doesn't do anything. I've got it so that it answers 1 if newGroup is activated, and it doesn't do that. I've put breakpoints and still nothing happens :(. I've steps through the code, and as far as I can tell (from reading the dictionary too), it should be all good, but it doesn't :(. I'm using LC 8 DP 14 if that makes a difference?

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: How to move everything

Post by [-hh] » Tue Mar 29, 2016 8:02 am

Did you try that (no grouping)?

Code: Select all

local dstnc -- moveAmount
on moveUpDown dy
  lock screen; lock messages
  repeat with i=1 to the num of parts of this card 
    set top of part i of this card to dy+the top of part i of this card
  end repeat
  unlock screen; unlock messages
end moveUpDown
----- NOW
put 40 into dstnc
moveUpDown -dstnc -- moves up 40 px
-- do your job
moveUpDown dstnc -- moves down 40 px
shiftLock happens

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: How to move everything

Post by jacque » Tue Mar 29, 2016 6:19 pm

If Hermann's method doesn't work, you can always store the name or ID of the selectedField and then restore the selection after the move.

Code: Select all

on keyboardActivated
   put the long ID of the selectedField into tFld
   repeat with i=1 to the number of controls of this card
      set the selected of control i to true
   end repeat
   group
   repeat with i=1 to the number of controls of this card
      set the selected of control i to false
   end repeat
  select text of tFld -- or "select after text" or "select before text", etc.
end keyboardActivated
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: How to move everything

Post by [-hh] » Tue Mar 29, 2016 7:08 pm

Instead of 'unselecting all in a repeat' one could use here simply "select empty", or am I wrong?
shiftLock happens

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: How to move everything

Post by jacque » Tue Mar 29, 2016 7:41 pm

[-hh] wrote:Instead of 'unselecting all in a repeat' one could use here simply "select empty", or am I wrong?
Good point, that should work. I didn't think to alter the original handler.
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 » Wed Mar 30, 2016 7:06 am

It works without grouping I think! There's a bit of a bug that I'm trying to figure out with regards to my calculations on how much space the keyboard takes up, but I think it's good! I was so preoccupied with whether or not I could group everything that I didn't stop to think if I should :P!

Post Reply