On 24/02/13 06:39, John Tall wrote:
Hello.
I'm familiar with GUI programming but is fairly new to GTK+ and GTKmm.
I'm going through the basics but is stuck on how to properly design my
application for use of tree views.
Let's say that I have an application that creates and runs a number of
"jobs". These jobs are displayed in a tree view where each job has a
job ID and a progress bar, where the progress bar shows how much of
the job that is done.
What is the appropriate way to update a tree view after it has been created?
John
Hi John,
"the appropriate way " is the one that works best - for any definition
of best :) .
You have to be a bit careful keeping pointers to a treeview row. If the
treeview gets updated at all, their behaviour is not guaranteed.
Had you considered using a signal to connect the widget to it's data?
You could either use a timeout:
Glib::signal_timeout().connect(sigc::mem_fun(*this,
&My_Widget::on_Update), 50); //50 msec between automatically running the
function
or a dedicated function that signals when the job has progressed by a
minimum amount:
Five_Percent_Change.signal_increment().connect(sigc::bind(sigc::mem_fun
(*this, &My_Widget::on_Update), New_Value));
Have a look in the sigc documentation at
http://libsigc.sourceforge.net/libsigc2/docs/manual/html/ch03.html
because there's a bit of work to create a class that emits a signal (as
opposed to simply receiving one). However, if you did it like that, you
can then leave the widget to update based on changes to the underlying data.
Ian.
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list