[Gtk-sharp-list] Help me with Invoke in Gtk

Duong Nguyen 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
        {
            get
            {
                return message;
            }
        }
        public MsgEventAgrs(string msg)
            : base()
        {
            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...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20061215/31c08d90/attachment.html 


More information about the Gtk-sharp-list mailing list