Bug or error Of programming


#1

I have a problem, in the two alerts although they have different name but same variable ‘choice’ when deploying the ‘alert’ and choosing to accept, execute the two actions regardless of what ‘alert’ has deployed or chosen.

Any advice, thanks!


#2

Well, maybe they are actually shared notifier? I always use only one notifier component in a screen, even with a lof blocks involving notifier.

I think what you can do is create a global variable to check which procedure this notifier input is for.


#3

What I do not understand is, why not even respect the ‘IF’ sentences.

At this moment I am using a single notifier but I still can not solve it.


#4

the AfterChoosing event will only fire for the Notifier.ShowChooseDialog method
see also the documentation http://ai2.appinventor.mit.edu/reference/components/userinterface.html#Notifier

ShowChooseDialog(text message, text title, text button1Text, text button2Text, boolean cancelable)
Shows a dialog box with two buttons, from which the user can choose. If cancelable is true there will be an additional CANCEL button. Pressing a button will raise the AfterChoosing event. The “choice” parameter to AfterChoosing will be the text on the button that was pressed, or “Cancel” if the CANCEL button was pressed.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.


#5

In fact, this is what I use, but I do not understand why I do not respect the ‘IF’ sentences. all the commands that are in ‘afterchoosing


#6

your latest screenshot looks fine… well, usually I use the = block from the math drawer to compare texts, but the compare text block from the text drawer should also do it…

what about adding a debug label to display the choice in the label…
also you could display in other test labels, if Limpiar or Restablecer has been chosen to verify, if really both actions are executed

Taifun


#7

Instead of if block, is if-then-else block. The at final else, display choice in a label. This way you can see if block gets triggered, and can inspect the choice value if none of conditions were met.


#8

Not working


#9

it does not work, it continues executing the blocks of the two sentences ‘if’. ‘call.cleanBD’ and ‘call.configuracion.clearall’

It does not matter which button you clicked on, ‘Limpiar’ or ‘Restablecer’.


#10

I just found this other problem.

even with this alert I run all the blocks that are in afterchoosing.


#11

Please prepare an example as small as possible, which demonstrates this issue an add debug labels as already suggested. Like this you probably will find your issue…

what about adding a debug label to display the choice in the label…
also you could display in other test labels, if Limpiar or Restablecer has been chosen to verify, if really both actions are executed

Taifun


#12

the label is marked in blue. , to know what value I am sending and receiving.


#13

I’ll prepare a simple app and post back


#14

Thanks for hoy atention @Nickon


#15

@BukanoR Take attached .aia and see how it works for you testNotifier.aia (37.8 KB)


#16

Thanks for help @Nickon , but I better shoot myself, I can not make it work.

in any option that I choose to execute the blocks that I have in the module ‘cleanBD’ and it is what really worries me because it removes all the information stored in sqlite and in 2 tinybd that I have with a different name ‘SettingsStorage’ and ‘DeudoresStorage’ Eliminate everything.

that’s why instead of using ‘DeudoresStorage.ClearAll’ I decided to eliminate tag by tag but even so I emptied everything of everything.


#17

I believe your issue is with TinyDB.
I had the similar issue when I used 2 TinyDBs in my app.
TinyDB data is stored in the same place so if you call “TinyDB.ClearAll”, it will delete all TinyDB data from all TinyDBs in your app.
Also if you call “TinyDB.GetTagsAndValues” it will get the tags and values from all TinyDBs in your app.


#18

thanks @Ken_Nichols is an excellent point to take into account when it comes to eliminating tinydb data.

but I do not understand why it also deletes data from sqlite, the function of empty sqlite data is in the module ‘cleanBD’ and this module runs no matter what selection made, or at least I believe that even with a ‘close’ button 'empty sqlite.


#19

Can we see the procedure ResetSettings?


#20

Of course, but there is not much to see there, I just made that module to organize the blocks a bit more and see the way they are executed, in the same way I can insert these blocks in the sentence IF option ‘Restablecer