Why are some of my blocks are being ignored?

image
When I click on the button I expect the text to change to "Trying to Connect...!" but it continues to display the default text until the BluetoothClient returns a result. I suspect this is to do with my lack of understanding of exactly when blocks are executed (being an old fashioned programmer with barely a few days experience with MAI).

It is working as expected.

Until the Bluetooth .Connect block returns a true or false, your initial text and colour will remain.

Sorry, just re-read - it is not showing the "trying to connect".....

In which case, it seems the Bluetooth.Connect block is running ahead of the intended changes. You may need to introduce a clock timer to call the connect blocks, only a short time like 100ms, in order to allow the textbox/label to change.

Try something like this:

grafik

image I just tried this hack works but the colours are subdued and it's not very elegant.

image
Anke gave me an idea and this one worked...
Seems I needed to delay the start of the Connect function until the button text had time to establish.

Thanks again Anke

Just for info...
I tried using the BlutoothError event and it didn't work.
Seems it is redundant and no longer used.
You get a message to that effect if you hover over the block.

Sorry TIMAI2, I only just spotted the last paragraph in your post which wasn't there on my first reading.
Seems we both came to exactly the same conclusion lol. It's working fine set to 50ms.

My fault, wasn't paying attention :wink:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.