mcgrathken.kmg
Posts: 0
Joined: Sat Feb 04, 2012 6:03 pm

How to implement a Counter

Hey Guys
Anybody know how to implement a simple counter in Tiggzi.
Let's say , an input field and a "-" button on one side and a "+" button on the other.
So basically, when the user clicks on a button the counter will increase and decrease accordingly.
I may require custom JavaScript an invoke on the click event ? or maybe I can set a variable and increment on click or something.Also i need to store the variable locally for distribution to Parse.

Thanks

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to implement a Counter

Yes, you would need to define a variable, then two buttons with click events. One button will decrease the value, one button will increase the value. As for sending to Parse, it's like any other input, just map the value to service input.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to implement a Counter

Image

On button click run this:

To add one:
code
var v = Tiggr ('countLabel').text();
Tiggr('countLabel').text(++v);
/code

To subtract one:
code
var v = Tiggr ('countLabel').text();
Tiggr('countLabel').text(--v);
/code

countLabel - name of the Label component.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to implement a Counter

I created a 'test' screen in your app where this is implemented.

mcgrathken.kmg
Posts: 0
Joined: Sat Feb 04, 2012 6:03 pm

How to implement a Counter

Great Max.....This works Perfect

Return to “Issues”