How to avoid "on text changed" event triggering on startup

I have used “On text changed” event bloc of text-box component but it is triggering on app startup,so how to avoid that…? I have attached the blocks i have tried with.

If your blocks are exactly your situation, and that all “On Text Changed” are calling “procedure” (you may wish to change that name at some point for one more descriptive, if your program gets more complicated…) then it could be a matter of putting an inhibitor and to remove that inhibition after a short delay.

Basically, you have a global variable (perhaps named activated) that is set to “false” from the get go.
And just to be sure that it is set to that, the first statement in your “Screen1.Initialize” is to set “activated=false”.
Then, in your procedure block, you now make it such that the update to Label1.Text is conditional to activated being true, that is

if activated then
set Label1.Text to (…)

Of course, now you will need to add logic to change activated to true, when the started is completed. This can be accomplished with a *clock component, set-up such that it will trigger only once (i.e. the when clock.timer event also deactivates the clock).
You will have to add the clock activation and the clock delay in your Screen1.Initialize as well.

When it should be triggered? What exactly is the goal?
Should the result be shown in Label1 only after all 3 TextBoxes have been entered?

My app is not complicated it consists of only those blocks which are in the question.

It has to be triggered only when there is change in text or number in any of the text boxes.My problem is as soon as the app starts the “On text changed is triggered” irrespective of change of text.I don’t want that to be triggered as my app starts i want that to be triggered when someone changes text in any of the 3 text boxes.

I get this when the app starts (with your blocks):

So why should TextBox.OnTextChanged be triggered when the app starts as long as there are no changes.

I don’t want to get that triggered .But in my case it is getting triggered.

how did you test the app through the companion or apk ? it won’t trigger in companion but it will trigger in apk, the text for label1 will be ‘0’ when app is installed through apk at startup.

ok, try something like this:


No,I don’t want to hide it won’t work for me,actually this is for another app for simplicity i framed question like this.

then try this:

1 Like

The procedure is different for me it contains manipulation of list ,string and many more and i am successful to manage that by checking length of list or other logic, but my question is why is it triggering on app startup ? Is there any wrong usage of blocks or it is a bug or it works like that.

Yes, this might be a bug, cant check this in AI2, because this event isn’t present there.

What should i do now?

There will certainly be a workaround, but for that we would need to know the exact purpose of your app.
What does it help if I or someone else makes suggestions and you then say that you have something else in mind.

1 Like

Add a Screen1.Initialize block to manage a temporary inhibition logic.

ya i know that,i was able to solve the issue regarding errors by using logic as shown but i wanted to know why it as been triggered(i thought there is problem from my side). And if it is a bug how to notify Kodular staff so that they fix this.

i didn’t get you, can you elaborate little more

It is possible that this is the result, not of a bug, but of the very nature of the operating system of multi-core Android devices. The system distributes the logical activities among several processing threads, which do not have to be kept synchronous. What is likely happening then is that the actual loading of the various components and their being filled with the initial value could be done successively in your Text_Box1, Text_Box2 and Text_Box3. If any of those is initialized a split second after the operating system sees the program as loaded (not waiting for a confirmation from any components) then it may come late enough to be seen as text changed, and that would trigger the On Text Changed event.

So, what you need perhaps is some of your own additional delay, where the code is told to disregard text change, because things may not have all been loaded yet.

What you do in this case is for your program to start a short delay clock, and that you make your program overlook and ignore any calls to your “procedure”. Once the clock fires (after half a second should probably be adequate), then you remove the inhibition.

What is inhibition and how to us one ?