How do you navigate in a list?

Ok, there are so much examples sometimes, with this topic but not a topic directly approached, and explained with a simple example to look it, understand it learn it , and then adapt it and use it, is there someone what can explain me this in a short example?

The blocks are there, but, how to make the right combination. I hope this is not a dump cuestion for you, because I for example have my issues to understand it... And somethimes other people to?

I mean the list what is created with data from the app, I don't mean the list of components where you find your blocks and extensions, I really mean the how to work with lists part, an in this , how to develop the navigation in it...

And the other problem the combination with other blocks, for example my prefered block : the "every-....." Block's.

There are the"every button" block, the "every label" block and others and you will find it down down down in the components list in the block desinger.....

Not too complicated. As i wrote you to your Imagesprite question. Every event (whic usually is a when any block have a component named component that is included in the event. If this component is in your list you can access to its position number in your list. You can use that component in that exact block the event happened (change or get its properties) or can access it later by its position number.
Here are the blocks:
image
Moreover check the functions of the list blocks on the left side of the screen. You can do lot of things with lists.

Yes, I m sometimes a little bit complicated, but I want to be sure that I form my cuestion correctly that the others really understand what I'm asking.,..

Ok thanks, then I will look and try to work with your examples

Ok, here, AIA file

leftedge_copy (2).aia (22.0 KB)

What I need:

Filling a global list named imagesprites
using "every imagesprite" block

Getting the number of how much imagesprites are in this list,

For each items in the list imagesprites Generate a number

Add the item "sprite" + number
Add the item number

And close the for each loop

Make an other for each loop

Select from the global list imagesprites
And select the second thing in the list

By the index nr. 2?

And take from this list the second thing

That will be "sprite" + number thing

And this will be:

Set the button "imagesprite" .text to select list item list " global Imagesprites"
And "index" will be "2" ?

And with this we set Button.imagesprite.text to Sprite1
Sprite2
Sprite3 .....
And so on....

Can you look over my AIA file and find out why it do not work?
Excuse that I ask you, but I am short before an explosion, and I lost confidence in my memory, I don't see what is my error and what overseeing wrong, or where is the error in my Programm... Thanks.

:slightly_smiling_face:

I see you have posted several thread for this app, and I read a lot of what you write, but still can not figure out what you want to achieve.
Can you please, forget about the block codes, just tell us in plain text, what you want your app to do, in details?

Yes, I want to have displayed in a button my things that I put in the Designer, with a name that says me what type of object it is and with a number to differentiate,... If I put 1 Sprite then I will se this in this button as a list, and if I put one more then I we this in this list..... And later I will work with this data but I will see it first. This is my way to learn and this is my way to work..... I will see it first then I create the next step... This is my way so I need it, I have in the moment the interest to learn it, and I must see to learn and understand, is this so abnormal, do it so? Excuse when I ask, and I have in the moment only this what interest me, there is no other plan behind only to manage this one button, and this combination of blocks... For me is important the result, how we come to this result, don't worry....I hope that im not ofending you or something, this is far away from me... You ask me and I reply and no other thing... Say me please if I make something wrong, or say something wrong, when there is only theory of wrongness, then please excuse me... Ok?.... I hope I will learn it that must not disturb you with, (if there are something dumb from my side, then excuse me please for this) everytime it's the same the think something, but then when they know me, than they like me but first it is sometimes difficult to understand me.

Thanks that you take your time with me....

This ?

image

I will try it, I hope it works, I hope I can count in you for the next cuestión in my learning process, sometimes we need some changes later... Thanks...

Ok, here is the thing, I adapted my AIA to your suggestions...

leftedge_copy (3).aia (22.0 KB)

But I do not need it like "many imagesprites to many buttons", I need it as "many Imagesprites to one button"...

In the Button "Sprites_names"

Ah... I see, we must change it to index 2 like in your example....
And if this block combination is the right combination to achieve this?

And how to combine it with your second "initialize" in your first picture

Can you help me to finish this second part, and if it's possible to simplify it, then do what you please, you are the teacher... Thanks....

Something like this maybe?

edit: I tried it but some reason breakes the length of the texts. Tried to change button width to percent value instead of automatic or fill parent. Did not help. Try to put into an arrangement.

Ok, I was making slightly the same, but ich was heaving a dublicating problem, wait I will attach the AIA file....
leftedge_copy (5).aia (22.3 KB)

It is a little overcomplicated. Why do you need the new spritename list? Well if you want to use it later, then ok. Anyway, you don't need the second for-each moreover it does not work the way you created. There is no index increment in that cycle so you need one like the one before it (spriteNumber) or you just forget the second for-each and put the set text block into the first for-each cycle.
Like this:


And you dont need to set the button width every time. Once is enough in the screen initialization.

Ok, I was see this too, (later wenn I was trying with the second for each loop) but the only thing what was staying, was this duplication problem, I mean, i n place of having, (Because we have 4 sprites, in the sprite_name.text it must normally comming out like this:

Sprite1
Sprite2
Sprite3
Sprite4 ... And finish.

But it was comming like this:

Sprites
Sprite1
Sprite2
Sprite3
Sprite4
Sprite1
Sprite2
Sprite3
Sprite4

But I will try it now by your way

The other problem is: the with of the button Sprite_name.text I need it = the length of the Sprites text only, and not 200 like i was putting it...

I was trying to solve it with the length correction Funktion/ Combination, but I was to tired, and i was not finisch it.

I will send you what I have now... Your changes I will make in one hour or so.... In the last time I was working so much...

Thanks for helping me

That duplication is because the whole block is in your timer2 block. And you start that timer in the screen initialization and only the reset button turn it off. If you want to turn it off in the timer block after the four sprites done, then you have to put the stop there.
Like this:

This is a good idea,To stop the clock on the final of the for each loop is one solution, but it is not the final solution, because i need the clock running forever, and only stop the clock by the reset.

Normally the for each block, must make his work only for each sprite provided by the every Sprite, and then stop. and I was thinking that wenn it reaches the last item from the every imagesprite, that then it stops, the restriction are provided by the every.... Block...

Ok it this is not so, then is there a short block combination to get how much block's are imagesprites?

To get the maximum number of imagesprites, to ensure that the for each block, only runs "every imagesprite block" = number= "number of runs" and runs only until reaches this number...

Because I need the everytime actuallysation from the clock, sometimes i will add other functions in this block or work further with this data, (inside this block for example)...

Is there a block that gives me how much items contains a list?

Yes I was see this, and understand the problem, and it is not possible to restrict it with a simple if spritenumber is < "lengt of imagespritenew list" because the list gets every time a new row in the list when te timer restarts, ok, then we need realy an imagesprite counter, that gives us the quantity of Imagesprites.

So we can use a simple if block, to restrict, the for each block,...

Or you have a better idea?

I don't really understand what do you want the app to do. There is 4 imageSprite now. Will be there more? If not then you can do it with checking the spritenumber.


This way the clock is running but stops writing t to the button after 4.
If there will be more imageSprites then you have to change the number in the relation.

I was found it out to, I investigate it along your example, and your conclusions...

And I was found out it's possible in the spritenames.text part to make it a little bit simpler... I will add the AIA file soon... To explain the little advantage that I was found in the possibilitys of the certain blocks... I must generate one first...

And you was asking me what App this will be, or what I will do with the app, but I will post it the complete thing, by the way is there a possibility to post my app as example for others, sometimes there are other people that need to solve the same issues like me in the past... I will give it to you for use it.... If you have something like a gallery of apps, then you can post it there....

And here comes my AIA file (my version before yours)


leftedge_copy (6).aia (23.2 KB)
So I have a saving too....

So, how you see in the final part:

I was find out, that the global variable already haves the data by lines one under an other, and it is not necessary to make the extra step to select it by the list block.... I don't know if this is new, but for me it works wonderfully.... And so I can display it directly by a label, button or i think by list block....

But an other thing what I will adapt indead, from your suggestion, is the if Block to make that the listmaker only ads an item, when SpriteNamesnew or the other list his length are < "every imagesprite" block.

By this method we can conserve the data in the lists work with them, and when I delete one button, or other object in the designer, it adapt s automatically.....

This is what I want to achieve, this I was making with qbasic, scratch, pocket code, tinker, and this is my way to make things, and prepare all part's of it that I can make changings without the need to change the programming, and here I go 1 step further, it adapts in the companion also, Because i put it all in clocks, and use the "every - ....- Block's"

In the first place I have only a little bit what I want to do with my app, but ich will make it adaptable.... With less work by the changes.... (I am a lazy developer)

It is not the same.That is a list and you print out the content of the whole meaning of that list including commas and square brackets and in case of text double quotes too.

Ah yes, now I see it, I was not looking to this because I was focused, on having only the 4 Objekts in my list... But he's you are right....

Ok, now I adapted all like you suggested with the restrictive if loop , to add items only when < 4, but with the automatisation with the "every imagesprite" block....

Here it comes....

leftedge_copy_1 (1).aia (23.6 KB)

In the next step I will work on the displaying without comas an other strange sign's....

So, now here are what I need for the moment ( what I will see on my screen)...

But it is only the nearest result, Because I was not able to get the real width of a letter... So I was search for the nearest numbers, to align the width of mi SpriteNames button...

leftedge_copy_1 (2).aia (23.2 KB)