SerialController DataAvailable


Just started again with Xojo and want to use it first for a simple RS232 program to stress test a serial device.

When pressing a button it sends out a command via serial port and receives immediately a response which is handled in the DataAvailable handler.
All fine up to this point.

Now before I can send the next command I set a global variable inside the handler to 1 so the button handler knows when to proceed.
But seems the global variable stays always at 0.

The serial handler ist from the Xojo barcode reader example:

If InStr(Me.LookAhead(Encodings.ASCII), Chr(13)) > 0 Then OutputArea.Text = OutputArea.Text + Me.ReadAll(Encodings.ASCII).Mid(2) App.SerialDone = 1 End If

And I test currently with this button handler (though here just with a delay of 1 second)

SerialController.Write(Chr(128) + “SerialCommand” + Chr(13))

[code]OutputArea.Text = OutputArea.Text + “Waiting” + Chr(13)
Dim waitUntil As Integer = Ticks + 60
While ticks < waitUntil

OutputArea.Text = OutputArea.Text + "Received " + Str(App.SerialDone) + Chr(13)

The output in a TextArea is always:

Waiting Received 0 DataFromSerialDevice