Hello Zol
I don't understand your question, it would help if your material matched your description - The '0's and '1's -why do you need a list of each?
Also, are you really using lots of canvasses - what is wrong with using sprites on a canvass?
Hello Zol
I don't understand your question, it would help if your material matched your description - The '0's and '1's -why do you need a list of each?
Also, are you really using lots of canvasses - what is wrong with using sprites on a canvass?
Hi!
Sorry, I'm not too good at anglish when it comes to complicated text compozition.I try to make it more understandable.
Here is what is in the channel and the Panels lists.I call this on app start.
Now if i click on the change color button on the emulator, that is the following block.
And for your question about sprites, i use canvases for one reason. Sprites doesn't have color feature, and it will be colored by a color picker, not just green and red. It is like a color pixel editor.
The first block, When any Canvas Touched, is used to indicate which canvases have been selected.
The second block, Button 12 click event, changes the colour of all canvases selected, ignoring those that have not been selected.
You have a method that works and one that doesn't - so I have to ask, why not just use the method that works?
As far as I can tell, you have 20 canvasses on one panel. Your code suggests there is more than one panel - how many panels are there? I ask because your code seems in danger of targeting the wrong panel, which would be why you don't see the expected result.
Yet another question - how many colours can be selected/applied?
Yes, the blocks works as you described.
For the first two question, i use the one that is work, i just wanted to know why the other one does not, if i forgot this later and try that version for an other app.
No more panel i just named it to panels because it will be an IoT app and one canvas will translate to one panel. So just one list with lot of canvas. There will be 150. This is just a test version with the 20 canvas.
For the last question, the color will be selected from a color picker more precisely from a color wheel, whis gives RGB from its pixel, so there will be countless colors.
See this sample project before you go overboard ...
So, final list will be huge - Use Make a List rather than a Procedure, that might be where the bug is hidden. Take care to name each Canvas to match the Item Number of the List.
I thougt of this, and tried it as well before. Same result. i can use the working method its just test.
In the meantime i did some testing and figured out what is buggy. The problem is with the "for each item in list function".
It doesn't pass the indexes to other lists if they are in this function, only the first index is passed to other lists somehow.
So this doesn't work: only the first index passes so only the first element is changes.
And this is work:
So i think it is a bug. I don't know if i can change the topic type from help to bug or i have to open an other one for bug report?
From your example, show the contents of "global list" and "global list2".....
Here: The first picture is before changes, the second after changes.
OK, the way you are doing with your blocks will return the first item of the list because all the values are 0's (zeros). You have to use the "for each number" (in list) block to work with these lists. Less of a bug, more of a feature, buried in the annals of android/AI2 development.
It doesn't matter what is in them. It doesn't work if i fill them any number or text instead of zero.
"For each number has" a disadvantage if the list length is unknown, (addign, removing elements). Of course it also can be tracked by a variable. As i mentioned before, i can work with either the "for each number" or the version where i strore the index value in the list. It is just came out because first time i tried with this method.
Use length of list block to get length of list
Ok! Thank you for your time. I take this question as solved.
Still this is a bug. I leave you to decide if have to solve with time or not.
Thanks again.
Hi Zol
It is a bug in your code
So long as list1 and list2 have matching indexes (as per my example), your code should be:
This if it's List2 you want to change
or This if it's List1 you want to change
No, it doesn't work. It doesn't accept item to index property. I've already tried that.
I correct it. It accept only f the elements are numbers.
But it is not working properly.
Oh sorry, my bad, that should be the index!
Also, note that using Index, the loop is in index (numerical) order whereas using Item, there is no specific order.
I know this is work. We discussed it with TIM, few posts before.
And no problem with it, i can use it, as the other working method i mentioend.
Just as i said, logic dictates if i have a list, i check its elements for a condition then its index that i can use for other tasks, thats why it was my first try.
And we can say the two is almost identical in case of lists. The "for each item in list" is like "for each number" using "length of list" as you posted, but buggy.
Anyway. Thank you for your ideas.
... I think you were expecting For Each Item to be in numerical order? It simply isn't and of course, since Item and Index are not the same thing, you can't cross-pollinate them.
That's not a bug.