开发者

AddChildAt() to add item at specific index position

开发者 https://www.devze.com 2023-03-06 17:09 出处:网络
I have a textBox and I am using it as a mail address input field where the user can type in several addresses, a bit same as in hotmail. Each address is rendered into a clickable button. Thus upon dou

I have a textBox and I am using it as a mail address input field where the user can type in several addresses, a bit same as in hotmail. Each address is rendered into a clickable button. Thus upon double-clicking on a specific address I want the item to be editable. After having edited the address when the user taps enter, the item is added to the list of mail adds.

I am adding it using the code below:

flowBox.addChildAt( myItem, myindex);

However addChildAt seems to add the item as the last item in the list. But I want it to add the item the position where it was originally. Say the item was at position 2 in the mail list, after editing adn tapping enter, it should add at position 2 itself and not at the end of the list.

Can you please tell开发者_StackOverflow社区 me if there is any way for doing this?

Thanks


Try to use addElementAt() instead. More details are here.


You can do what Constantiner has suggested, perhaps it's addChildAt(index).

The other way of doing is just hide the child and show the child instead by visible property instead of removing and adding

0

精彩评论

暂无评论...
验证码 换一张
取 消