Results 1 to 2 of 2

Thread: Display in graphical interfaces when using callback or IceStorm

  1. #1
    fengshengheli is offline Registered User
    Name: zhang mq
    Organization: sddl
    Project: substation
    Join Date
    Sep 2008
    Posts
    9

    Question Display in graphical interfaces when using callback or IceStorm

    Hello,
    My server get file form remote, and my client get state when the server getting files. I shoud use callback mechanism or IceStorm putting message from server to client. My ice like:

    module Demo{

    interface msgCallback{
    void transferred(string message);
    };

    interface getFileStorm{
    void bcstMessage(string message);
    };

    interface myComm{
    bool getFile(string filename, msgCallback* cb);
    };
    };

    In the client, my callback definition like:
    class CallbackReceiverI : public msgCallback
    {
    void transferred(const string& message, const Ice::Current& cur)
    {
    TRACE("%s\n", message.c_str()); // OK
    c_pDlg.strMsg = message; // a global pointer to a dialog
    c_pDlg.UpdateData(FALSE); // fail
    }
    };

    The subscribe side definition like:
    class MyStormI : public getFileStorm{
    virtual void bcstMessage(const string& message, const Ice::Current& cur)
    {
    TRACE("%s\n", message.c_str());
    c_pDlg.strMsg = message;
    c_pDlg.UpdateData(FALSE);
    }
    };

    The messages display in console OK, but fail in graphical interfaces. The error message in the attach files. How could this be? What can I do. Help me. Thank you.
    Attached Images Attached Images

  2. #2
    matthew's Avatar
    matthew is offline ZeroC Staff
    Name: Matthew Newhook
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Feb 2003
    Location
    NL, Canada
    Posts
    1,458
    What does UpdateData do? Assuming that this calls directly on some GDI object, you must not do this. Callbacks in Ice come from a thread other than main, and therefore cannot update GUI objects. Instead, you should process this data in the main thread. You can look at a series of articles I wrote on this in "Integrating Ice with a GUI" in Connections issues 12, 13, 14 & 15 (http://www.zeroc.com/newsletter/index.html), or the articles on the chat demo (http://www.zeroc.com/chat/index.html), or finally in the MFC demo (demo/Ice/MFC) in the Ice distribution.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. IceStorm Subscriber callback
    By mwtupper in forum Help Center
    Replies: 5
    Last Post: 06-30-2010, 04:07 PM
  2. Multiple instances of interfaces.
    By nickadamson in forum Help Center
    Replies: 2
    Last Post: 11-15-2007, 10:25 AM
  3. iceadmin - a graphical frontend for IcePack
    By istvan in forum Comments
    Replies: 0
    Last Post: 11-16-2005, 07:04 PM
  4. Replies: 1
    Last Post: 07-30-2005, 07:12 AM
  5. Ice with Graphical Applications
    By spiff in forum Help Center
    Replies: 3
    Last Post: 03-25-2005, 03:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •