Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

add instance before existing instance

jaffan72
Level 2
Level 2

Hello all,

is there a way to add a new instance of a Subform to show in a top the existing subform? the way it works now when you add a click on button to add a subform, the new subform shows under the exisitng subform and so forth, every time I add a subform it goes to the bottom. I want the opposite to happen where new subforms, always show in the top of old subforms.

1 Accepted Solution
jasotastic81
Correct answer by
Level 7
Level 7

It depends on where you want the subform to actually go.

Suppose you have a button inside a subform and you always want the new subform to go on top of the entire stack of subforms:


this.parent.instanceManager.insertInstance(0);


If you want to add it right above whatever instance you're working on, then this code will work:


this.parent.instanceManager.insertInstance(this.parent.index);


Note: You'll need to add or remove reference points depending on what you're using to trigger the event, of course.

View solution in original post

2 Replies
jasotastic81
Correct answer by
Level 7
Level 7

It depends on where you want the subform to actually go.

Suppose you have a button inside a subform and you always want the new subform to go on top of the entire stack of subforms:


this.parent.instanceManager.insertInstance(0);


If you want to add it right above whatever instance you're working on, then this code will work:


this.parent.instanceManager.insertInstance(this.parent.index);


Note: You'll need to add or remove reference points depending on what you're using to trigger the event, of course.

View solution in original post

jaffan72
Level 2
Level 2

Fantastic... it worked ..excellent..thank you very much