Hanks wrote:
Thank you for your advice, I read it for several times, it
seems to be
work for me,^_^. The key point is how to solve
communications among
threads, and how to rerange them to the text control.
I will try the styledtextctrl.
Threads are irrelevant here. Go to a whiteboard and sketch out a
diagram of how this application has to work. I think you do not
understand yet how it must operate.
You will need a server. Unless your collaborators happen to be
inside the same corporate network, you cannot connect them directly,
peer-to-peer. Corporate routers and firewalls do not allow that.
You would have a server that all of the clients connect to.
So, user A types a couple of characters in a text box. Your app
will have to detect that, and send a message to the server that says
“hey, user A just typed ‘xxx’ in text box 23”. Your server will
then forward that to all the clients that are listening.
User B's application will receive that message over a socket
(presumably). The socket handler function just has to send that as
a custom message to your main window. There are several ways in wx
to send yourself a message. Your main window will then receive this
message in its event handler, and can go set the value in the text
box. Because you used a message, you KNOW that the message handler
is running in the main thread, and is thus allows to touch the UI.
I believe you could also do this with the "pubsub" module.
···
-- Tim Roberts, Providenza & Boekelheide, Inc.
timr@probo.com