Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Creating buttons in a loop

$
0
0

hello I need your help because I have a problem on my application.

I created a loop that pluseurs buttons. Buttons display correctly but when I click on a button it nothing happens.

I can not know which button I click.

Here is my current code:

`var rows = BDD.execute('SELECT * FROM SEANCES WHERE ID_ENTRAINEMENT=?', ChoixEntrainement); Titanium.API.info('ROW COUNT = ' + rows.getRowCount());

var seance = []; var nb = '1'; var posDepart = '120'; var posY = posDepart; var Choixseance = '0';

while (rows.isValidRow()) { seance[nb] = Titanium.UI.createButton({ backgroundImage:'/images/background_menu.png', title: rows.field(1), font:{fontSize:25,fontFamily:'Helvetica Neue'}, top:posY, width:'90%', height:'30' });

ViewListeSeance.add(entrainement[nb]);
posY = (posY*1) + (30*1);

seance[nb].addEventListener('click',function(e){
    ChoixSeance = rows[0];
    rows.close();
    ViewListeSeance.removeAllChildren();
    Titanium.include('description_seance.js');
});

nb++; 
rows.next();

} `

Thank you for your help!


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>