Page 2 of 2

Re: How to move everything

Posted: Tue Mar 29, 2016 6:51 am
by Opaquer
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?

Re: How to move everything

Posted: Tue Mar 29, 2016 8:02 am
by [-hh]
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

Re: How to move everything

Posted: Tue Mar 29, 2016 6:19 pm
by jacque
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

Re: How to move everything

Posted: Tue Mar 29, 2016 7:08 pm
by [-hh]
Instead of 'unselecting all in a repeat' one could use here simply "select empty", or am I wrong?

Re: How to move everything

Posted: Tue Mar 29, 2016 7:41 pm
by jacque
[-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.

Re: How to move everything

Posted: Wed Mar 30, 2016 7:06 am
by Opaquer
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!