2006-03-28, 23:24
this function automatically sets the navigation for a set of buttons depending on how many buttons in columns/rows there are.
this is working fine in one of my scripts where i have several rows & columns.
in my new script i have only one row, with 11 buttons (horizontal)... and when i use the 'up' button, it moves the highlight to the left, and 'down' to the right... i want to make it opposite.
thanks in advance!
if someone can explain 'how' it works that would be great too!
this is working fine in one of my scripts where i have several rows & columns.
in my new script i have only one row, with 11 buttons (horizontal)... and when i use the 'up' button, it moves the highlight to the left, and 'down' to the right... i want to make it opposite.
thanks in advance!
if someone can explain 'how' it works that would be great too!
Quote: for n in range(btns): # loop to create button navigation
nud = (n+1)%btns # (n+1)%totalnum --- wraps navigation
nei = n + buttonspercolumn
if nei >= btns:
nei = nei % buttonspercolumn
self.btnevent[nud].controlup(self.btnevent[n])
self.btnevent[n].controldown(self.btnevent[nud])
self.btnevent[nei].controlleft(self.btnevent[n])
self.btnevent[n].controlright(self.btnevent[nei])