Avatar

Level 3

I got it to work with one little hitch. The moveInstance method moved the instance to the position after the one designated by newIndexPostion. That's what I wanted so I just let the index of the current instance be the second parameter. I knew it would be simple. Thanks.

Here's the code from the click event:

// Save the current instance index and location

var i = this.parent.index;

var MyLocation = this.somExpression;

// Add the new instance

parent.instanceManager.addInstance(1);

// select the instance to be relocated (in this case, it's the one just added)

var last = this.parent.instanceManager.count - 1;

// Move the new instance to the desired position after the current instance

parent.instanceManager.moveInstance(last, i);

// Set the cursor position for when the screen is redrawn.

xfa.host.setFocus(MyLocation);