[Gtk-sharp-list] Help me with Invoke in Gtk
duongnguyen at mail.ru
Fri Dec 15 12:48:30 EST 2006
Hello, Help me with Invoke in Gtk.
I have custom EventArgs and EventHandler
public class MsgEventAgrs: EventArgs
private string message;
public string Message
public MsgEventAgrs(string msg)
this.message = msg;
public delegate void MsgEventHandler(object sender, MsgEventAgrs mea);
And I have a class ChatClient (the class must be designed to work with every interface-platform, so I can not put the chat-message directly to any Gtk Control like TextView or Entry inside the class, instead, I must write some custom Event, which will be fired each time my ChatClient receives message). And here is some code from class ChatClient
public event MsgEventHander OnAddMessage
public void OnReceiveData(...)
string msg = received message
MsgEventArgs mea = new MsgEventArgs(msg);
// here I must fire the event to send my message to the main application, which will display the message
Invoke(OnAddMessage, this, mea);
Of course, this Code is written in C# + WinForm. I can not find the similar thing in Gtk, pls help me with this problem!
Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Gtk-sharp-list