0
Answered

Set/add counter

Anita Sølver 6 years ago in By Screen / Design • updated by Alin Alexandru Matei 6 years ago 9
I am trying to use a counter. Right now, I'm trying to get the counter to show, but I can't make it work. It's probably just me, so thought I'd ask for help :)

I can't get the timer to show up. I have tried both with the tap/set from another object (like described here: http://interactbuilder.screenstepslive.com/s/5404/...) and to do it on the counter itself on page load.

This is the counter
(The last image is an item on the page, that should add 1 to the counter, when tapped. But first I want to see the counter, so I can check that it's doing what I want it to do.)

Can you tell me what I do wrong?
Thanks :D








Answer

Answer
Answered
First chain the Counter Display to the Counter Set and leave only the counter set to Execute on Page Load.
Secondly chain to the Counter Add a Counter display also, so when you add to that counter it's value will be updated
GOOD, I'M SATISFIED
As always, great support!
Satisfaction mark by Anita Sølver 6 years ago
Under review
First chain the Counter Display to the Counter Set and leave only the counter set to Execute on Page Load.
Secondly chain to the Counter Add a Counter display also, so when you add to that counter it's value will be updated
Now they're chained, and it doesn't do any difference. It's still not showing up.





Nevermind. I added the counterdisplay to the element with counteradd, and THEN it worked. I have no idea why, but if it works, it's fine by me ;)

EDIT: The counter doesn't show before there's added something to it, it seems. It starts at zero, and the moment I click and thus add 1, it shows up. Just to clarify for anyone who might read along now or later.

Thank you! :D
I've attached a sample app to see how to display the counter on Page Load. Also if you tap the +1 element, the counter value will increment with 1:
100 - counter display.zip
Answer
Answered
First chain the Counter Display to the Counter Set and leave only the counter set to Execute on Page Load.
Secondly chain to the Counter Add a Counter display also, so when you add to that counter it's value will be updated
You're the best! Thank you :D
Okay. I'm truly baffled!

I have looked and looked, and compared your settings to mine.
I have all the same settings. I made a new app with a single page, to start from scratch, and to make sure, that no old settings were getting in the way.

The counter is working, but it's not showing up, until I click the on the addcounter button.
As I said, I have all the same settings, I even took screenshots of all your settings, so I could compare, side by side, to see if I missed anything. And I really can't see what it should be.

Then I decided to copy your counter into my own app, to compare. That got me an error  when going to interact and a prompt to restart the program.

I then thought, that perhaps, it was because there was some sort of interaction between the two elements, that the counter was missing, so I deleted that again, restarted, copied both elements, and pasted them on a new page in my own app. Same error when going to interact.

So what do you think? How can this be?
Is your program version different than mine, and how can the app you provided work in my program, but not when copied?

I really don't get it. That counter just doesn't show, before counteradd is tapped.

Here's the error from the copied version, that I get when entering Interact:


InteractBuilder Version: 3.3 Build 325
Device: iMac
Processor: Intel Core 2 Duo
Memory: 4 GB
System: 10.9.1

--------------------
An application error occurred while attempting to perform the last action.

Restarting InteractBuilder is recommended.

An application error occurred while attempting to perform the last action.

Restarting InteractBuilder is recommended.

Error: Chunk: error in object expression / Chunk: can't find object / Object: does not have this property / put: error in expression
Handler: Behavior_CounterDisplay
Hint:
Location: Line 4883, char 34
Object: button id 1008 of group id 1010 of card id 1002 of stack "Behaviors" of stack "/Applications/InteractBuilder.app/Contents/MacOS/Local Components/Data/InteractBuilder.livecode"

69: Line 4883 at char 34: Chunk: error in object expression
77: Line 4883 at char 34: Chunk: can't find object
456: Line 4883 at char 17: Object: does not have this property
465: Line 4883 at char 1: put: error in expression
253: Line 4875 at char 1: if-then: error in statement
253: Line 4874 at char 1: if-then: error in statement
253: Line 4872 at char 1: if-then: error in statement
241: Line 4872 at char 1: Handler: error in statement ----> Behavior_CounterDisplay
353: Line 0 at char 0: Object Name: ----> button id 1008 of group id 1010 of card id 1002 of stack "Behaviors" of stack "/Applications/InteractBuilder.app/Contents/MacOS/Local Components/Data/InteractBuilder.livecode"
675: Line 3245 at char 1: ----> Behavior_CounterDisplay
587: Line 3202 at char 1: switch: error in statement
253: Line 3172 at char 1: if-then: error in statement
253: Line 3169 at char 1: if-then: error in statement
253: Line 3095 at char 1: if-then: error in statement
241: Line 3095 at char 1: Handler: error in statement ----> _Behavior_Do
353: Line 0 at char 0: Object Name: ----> button id 1008 of group id 1010 of card id 1002 of stack "Behaviors" of stack "/Applications/InteractBuilder.app/Contents/MacOS/Local Components/Data/InteractBuilder.livecode"


line 150 of handler "errorDialog" of button "stsErrors_FS" of card id 1002 of stack "libSTSErrors"
line 14245 of handler "DoError" of stack "InteractBuilder" of behavior button "Stack B" of card id 1002 of stack "Behaviors"
I'm using 3.3 build 325 same as you, the error that you get it's a bug that we are aware of and that is fixed in the next version of the builder. Try making the behaviors by using the + sign as shown in the image and not from Action Manager and see if it's working in that case.
I have made them from the + sign, since the manager isn't working very well (for me, at least). Ican try again with a fresh page, and see if it's better. Is there anything else I can do? I can't make a child behaviour directly from this place, can I?
After you made both behaviors from the +sign  then you can go to Action manager and chain them.
That's what I did. Do you know any other things, that can affect the bug to occur, so I can avoid them?