RE: What is the minimum number of lines to update a gui window without user clicking a button



I have unsubscribed from this list, please delete me from the list.



-----Original Message-----
From: gtkmm-list [mailto:gtkmm-list-bounces gnome org] On Behalf Of Andrew Potter
Sent: Monday, August 19, 2013 7:08 PM
To: L. D. James
Cc: gtkmm-list gnome org
Subject: Re: What is the minimum number of lines to update a gui window without user clicking a button

Adding these methods to the Example class show how you can use a local helper function. The downside is you 
having an extra method lying around and remembering to use the right one in the right context; in
C++11 you could get rid of gui_append_mainloop() by using a lambda.

Edit: This uses the approach Gavin just suggested. He's right in that I probably should have used that 
approach in the first place.

// Extra methods for Example 5
    /* Append to the textbuffer in a thread UNsafe manner. Should only
     * be used on the Main Loop. */
    void gui_append_mainloop(const Glib::ustring& str) {
        Glib::ustring text =  tb->get_text();
        text += "\n" + str;
        tb->set_text(text);
    }

    /* Threadsafe access to gui_append_mainloop */
    void gui_append(const Glib::ustring& str) {
        callback_dispatcher.send(sigc::bind(sigc::mem_fun(this,
&Example::gui_append_mainloop), str));
    }
// Extra methods for Example 5
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]