HOW TO HAVE TWO DIFFERENT LABELS FOR TWO DIFFERENT BUTTONS.

419 views
Skip to first unread message

Ggaayi Abraham

unread,
May 23, 2019, 4:56:24 PM5/23/19
to MIT App Inventor Forum
Hey everyone.
My issue is, I have two different buttons for them to display different results. I would like to create two different labels for the results, so that the procedure of one doesnt interfere the other command.
Can I please have some help on this?
Thanks a bunch.
question.PNG

ABG

unread,
May 23, 2019, 6:33:04 PM5/23/19
to MIT App Inventor Forum
I assume you want the button Click to determine where the incoming BlueTooth data should be posted when it arrives.

One way to do this would be to use a global variable with the component block for the desired target label,
and have the button Click event switch the global to point to the appropriate Label.

When the data arrives, use the global variable contents and the set Any Label.Text block to
display the new data.

Since I don't have BlueTooth in my PC Emulator nor a car in my living room,
(you're still working on that OBDII app, right?)
here's a sample app using a repeating Clock to deliver incoming data.

After each button is pressed, its associated Label received new time signals.

ABG

blocks.png
Capture.PNG
delayed_output.aia
Designer.PNG
Reply all
Reply to author
Forward
0 new messages