I’m new to niotron and I want to know how I can make a simple button counter where by pressing a button it will add +1 to a counter
Just drag a button and a label
And set “0” to label.
Drag “when click button1” block
Join “setText” label block with button block.
Drag + block from ‘math’ category and join it with label block.
Now + block have two joinable augments.
In first argument join “getText” label block.
In second argument join “0” (drag from math category).
First, create a button, and then in the blocks section you can make something like this:
In this way, the number of times the button is pressed will be saved in the counter
variable.
You can then use the get global counter
wherever you want if you need to use the value. For example, if you need it to be shown in a label, you can do it like this…
Yes, but it is great if he use tiny db to get count number after close and reopen the app