HTTPSoket e Canvas

Ho modificato l’esempio HTTPSokerGetExample aggiungendo un canvas e cercando di scrivere nel canvas il contenuto della TextArea nell’Action del GoButton con:

MySocket.Send(“GET”, URLField.Text.ToText)
Canvas1.Invalidate

nell’Evento Paint ho:
g.DrawString(ResponseArea.Text,10,10)

ma non funge: come mai?

You need to wait for the request to finish before calling Canvas1.Invalidate. A good place to put it is next to the line of code that populates the ResponseArea:

ResponseArea.Text = content Canvas1.Invalidate

Thanks. It works!