Setting variables and how to using advanced

Hi,
I’m curious about dealing with variables.
I looked up the training pages. but I couldn’t understand exactly.
I like to set a variable to each objects.
and when the object is on ‘selected state’, I want to calculate the total of values of variable and show how much is it.

I created Global Variables(Var1, Var2, …). I gave integer as a Default Value.
And I made object to have selected state(OnLongClick), I set in case 1 as ‘Set is selected of This equal to “toggle”’. also I set in case 1 as 'Set value of Var1 to value of Var1(I used value of variable).

Am I doing right? is not so, please help me.
and I also want to show the total values of selected. how can I do this?

I found out that I can show the value by using set text, but still I can’t to show the total value of only selected ones…

Hi!

If you want to refer to other objects - as you want to here upon selecting your widget - you should use local variables.

I put together a post describing how to use local variables a while back. Let me know if this does not help.

Hi!
It’ll be very helpful.
Thanks!
I’ll gonna try to make it by myself first. but may be there will be some trouble while I’m doing my project. if so, may be I’ll gonna ask you some questions.
thanks.

It was very helpful! but I’m now having some troubles.
how can I do with in function(fx) to variables only have those value when is on selected state. like such as var1.selected? I tried this but did not work. is there any way to make this work?
and I like to know how to limit the sum of variable to the special state, such as positive or lesser than 100.

Hi!

I don’t quite follow what you are trying to do. Can you post an example, or if not that a screenshot describing what you are trying to do?