How to use Start value block?

When the Button is Clicked
Get ID of Button Component
And pass that as Start Value.

And Button ID should be - level + number

yes, i have set my button name as level + number = level1

nothing is working

Then this will work.

You should change Start Value from Component to ID of Component.

but i am not using dynamic buttons. i am using normal buttons

please help

Oh Sorry.
My mistake.
Forgot to Ask.

I thaught you encountered this while changing your App Components to Dynamic.

Here i can’t Help.
As while testing Static Components with Component as Start Value
we get this as Start Value -
com.google.appinventor.components.runtime. + Component Name + @ + random numbers. ( that also keeps changing )
Not what you have named the Component.

ohh no i am too close to my app.
please do something.

i will cry :sob: :sob: .
please help

Still you can use the ids way.We can use dictionaries.For example initialize global dict to some keys and values.Every key will be like that The key = the component and the value = your id ( unique one for every id ).And use @ADDYLIN method but instead of using get id block you will use get value the key = your component,your dictionary = your dictionary variable, dict for example.And let valueif not found as it is.


There is another way using list of lists but it will be much harder.Using dictionaries is easier :wink:


Fun fact.Even @yusufcihan using this way in his dynamic component extension method exactly with the hashtable class ( similar to dictionaries )

3 Likes

Correct! Those are very very helpful in any of the programming language.

3 Likes

thanks ,
but i don’t know how to use dictionaries.
can you show me blocks . how to use that (only for educational purpose)

3 Likes

Check out my guide: Guide: Dictionary Blocks

And Kodular documentation as well.

3 Likes

i have try but nothing understand .
can you please show me blocks how to use in my condition

1 Like

please help

you can try to make blocks as i’ve told you in my first post.If there is a problem just show your blocks and we will try our best to help you.This way will help us all to learn instaead of giving pre made blocks :wink:
BTW, see the guide provided by @WatermelonIce it will help you understand dictionaries better.

2 Likes

dictionaries works between 2 screens

Nope you will need to pass the value in the start value or in tiny db

1 Like

Why don’t you pass the Button.Text of the button instead? Doesn’t the text says what level the user wants?

1 Like