Broken Control.Move on a panel container
#1
When using Control.Move(id,-1) or Control.Move(id,1) on a panel it doesn't move to the previous or next item, instead it moves to the previous or next row.

Is this broken? Is there a way to move a panel container to the previous or next item?
Reply
#2
It's always been like that.

I use this trick to make it appear to move to the next row when using left and right:

xml:
<onleft condition="!String.IsEmpty(Container(51).ListItemNoWrap(-1).Label)">SetFocus(98)</onleft>
<onleft condition="String.IsEmpty(Container(51).ListItemNoWrap(-1).Label)">Back</onleft>
<onright condition="!String.IsEmpty(Container(51).ListItemNoWrap(1).Label)">SetFocus(99)</onright>
<onright>noop</onright>

xml:
<control id="98" type="button">
<onfocus>Control.Move(51,-1)</onfocus>
<onfocus>SetFocus(51)</onfocus>
<onfocus>Right</onfocus>
<onfocus>Right</onfocus>
<onfocus>Right</onfocus>
<onfocus>Right</onfocus>
<include>HiddenControl</include>
</control>
<control id="99" type="button">
<onfocus>SetFocus(51)</onfocus>
<onfocus>Left</onfocus>
<onfocus>Left</onfocus>
<onfocus>Left</onfocus>
<onfocus>Left</onfocus>
<onfocus>Control.Move(51,1)</onfocus>
<include>HiddenControl</include>
</control>
So you need to add the Left or Right commands depending on the number of columns you have.
Reply
#3
Quote:I use this trick to make it appear to move to the next row when using left and right:

Thanks but I'm not trying to move to the next row using the panels left/right. I understand that your solution is to overcome that a panel wraps around on the same row instead of resetting to the left and moving down a row. That's not what I'm trying to do.

What I'm trying to do is move a panel from one item to the next using a button:-

Code:
<control type="panel" id="100">
..... 2 items wide, x items height
</control>

<control type="button" id="200">
  <onleft>Control.Move(100,-1)</onleft>
  <onright>Control.Move(100,1)</onright>
</control>

For example a vertical panel:-

Code:
+---+---+
| 1 | 2 |
+---+---+
| 3 | 4 |
+---+---+
| 5 | 6 |
+---+---+

Every time Control.Move(100,1) is called then the panel should change focus in order 1,2,3,4,5,6,1 and the same in reverse for Control.Move(100,-1)

However Control.Move(100,1) actually moves 1,3,5,1,3,5,1,3,5
Reply
#4
Modify the panel controls I posted to use them in a button instead.
Reply
#5
Thanks, but that was the first thing I tried after your initial post,  I just couldn't get your code to work Sad

Finally got the following to work for a 2 column panel, no need for extra buttons:-

Code:
<control type="button" id="200">
  <onleft>SetFocus(100)</onleft>
  <onleft condition="Container(100).Column(0)">Up</onleft>
  <onleft condition="Container(100).Column(0)">Right</onleft>
  <onleft condition="Container(100).Column(1)">Left</onleft>
  <onleft>SetFocus(200)</onleft>
  <onright>SetFocus(100)</onright>
  <onright condition="Container(100).Column(0)">Right</onright>
  <onright condition="Container(100).Column(1)">Down</onright>
  <onright condition="Container(100).Column(1)">Left</onright>
  <onright>SetFocus(200)</onright>
</control>

It's just a shame that `Control.Move()` is broken for panels Sad

Thank for the help pointing me in the right direction Smile
Reply
#6
Here's a no wrap version for future reference:-

Code:
<onleft>SetFocus(100)</onleft>
<onleft condition="Container(100).Column(0) + !Integer.IsEqual(Container(100).CurrentItem,1)">Up</onleft>
<onleft condition="Container(100).Column(0) + !Integer.IsEqual(Container(100).CurrentItem,1)">Right</onleft>
<onleft condition="Container(100).Column(1)">Left</onleft>
<onleft>SetFocus(200)</onleft>
<onright>SetFocus(100)</onright>
<onright condition="Container(100).Column(0)">Right</onright>
<onright condition="Container(100).Column(1)">Down</onright>
<onright condition="Container(100).Column(1) + !Integer.IsEqual(Container(100).CurrentItem,Container(100).NumItems)">Left</onright>
<onright>SetFocus(200)</onright>
Reply

Logout Mark Read Team Forum Stats Members Help
Control.Move on a panel container0