Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to remove a view in corona using its id?
    primarykey
    data
    text
    <p>I have multiple views create using a loop its a button and a textview actually, how do you remove one of them using id?</p> <pre><code>for i=1,#displaymovenames do moveButton = widget.newButton { default = "closeBox.png", over = "openBox.png", width = 50, height = 50, onRelease = startMove, id = moveID } moveButton.x = 50; moveButton.y = boxy local deletemove = widget.newButton{ default = "remove.png", over = "removeOver.png", width = 30, height = 30, id = moveID, alpha = 0, onRelease = deleteSelectedItem } deletemove.x = _W + 20; deletemove.y = deletey t = display.newText(displaymovenames[i], 85, texty, native.systemFont , 13) t:setTextColor( 0, 0, 0) t.id = moveID boxy = boxy + 65 texty = texty + 65 deletey = deletey + 65 moveID = moveID + 1 moveitemscroll:insert ( moveButton ) moveitemscroll:insert ( t ) deletemoveGroup:insert ( deletemove ) end </code></pre> <p>well basically what this code does is that when the deletemove button is pressed the <code>moveButton</code>, <code>deletemove</code> and <code>t</code> are remove this is the function responsible for the remove:</p> <pre><code>deleteSelectedItem = function ( event ) event.target:removeSelf() end </code></pre> <p>as you can see I am only able to remove the view that is being pressed how about the other view that are being pressed? how can i remove them? can i use id right? if yes how?</p> <h1><strong>Edit</strong></h1> <p>What i just wanted to do is this. Think of this items below as view.</p> <pre><code> ------ ------------- ------- |image1| |anotherimage1| |button1| ------ ------------- ------- ------ ------------- ------- |image2| |anotherimage2| |button2| ------ ------------- ------- ------ ------------- ------- |image3| |anotherimage3| |button3| ------ ------------- ------- ------ ------------- ------- |image4| |anotherimage4| |button4| ------ ------------- ------- </code></pre> <p>when <code>button1</code> is press <code>button1, image1 and anotherimage1</code> is remove from the view and so on.</p> <p>I can accomplish this if I just place them in a group the problem is that the buttons are already assigned to a different group. Is there any other way to solve this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload