Page 1 of 1

Changing background color for multiple buttons at once

Posted: Sun Jan 19, 2020 5:47 pm
by Opaquer
Hey guys!

It's been a while since I've done any sort of coding, and lately I had an idea to make my own Sudoku style app for Android. I have some of it already, but had some questions. Firstly I have the ability to select cells and hilight them by dragging your finger through the square, which is pretty cool. The idea is you can select cells, put numbers/pencil markings in and then keep going. Ideally when you select a cell, they'll remain selected until you touch the screen again, at which point they'll deselect.

I've got an array of 81 keys with whether the cell has already been selected or not to keep track of which cells should be hilighted and which shouldn't, and that's all working well - you run your finger through the cells you want and they turn a nice yellow to show that they're hilighted, and you run them through again and they deselect. However, I want it so that when you put your finger down, it instantly deselects all the cells. The problem is that the only way I can find to reset the background color is by doing a repeat with loop, and with 81 cells, on my phone it takes a second or two to finish. Is there any way I can do anything to make it so that as soon as my finger touches down, all the cells reset to their original colour?

Thanks in advanced!

Re: Changing background color for multiple buttons at once

Posted: Sun Jan 19, 2020 5:53 pm
by Klaus
Hi opaquer,

did you "lock screen" before you change the color of your 81 buttons/cells in a loop?
That usually speeds up things a LOT! :-)


Best

Klaus

Re: Changing background color for multiple buttons at once

Posted: Sun Jan 19, 2020 5:55 pm
by Opaquer
Hi Klaus

Thanks for the super quick reply! I did not - didn't even know it was an option! I gave it a shot and it worked a treat! Thanks so much!

Now to work on the hard part of my app - generating, testing, checking and sharing Sudoku puzzles!