Re: What is the minimum number of lines to update a gui window without user clicking a button
- From: "L. D. James" <ljames apollo3 com>
- To: Markus Elfring <Markus Elfring web de>
- Cc: gtkmm-list gnome org
- Subject: Re: What is the minimum number of lines to update a gui window without user clicking a button
- Date: Tue, 20 Aug 2013 07:59:16 -0400
On 08/20/2013 04:44 AM, Markus Elfring wrote:
HelloWorld::HelloWorld() : m_textview() {
add(m_textview);
m_textview.show();
Glib::Thread::create(sigc::mem_fun(*this, &HelloWorld::cpp_app),
true);
}
[...]
void HelloWorld::cpp_app() {
string texttoprint = "";
Glib::RefPtr<Gtk::TextBuffer> m_refTextBuffer;
m_refTextBuffer = Gtk::TextBuffer::create();
string runit(std::string c);
texttoprint +=
"About to run a number of c++ functions\nand display the
results\n";
m_refTextBuffer->set_text(texttoprint);
m_textview.set_buffer(m_refTextBuffer);
sleep(10); // This sleep function represents any c++ function
performaing a task
I would like to clarify implementation details a bit more from this
programming attempt. Can it be that the referenced text buffer is
written in a thread-unsafe way here?
How do think about to apply improved techniques and software
ingredients like locks for memory consistency?
(Andrew Potter and Gavin Lambert suggested also an alternative program
structure. -
https://mail.gnome.org/archives/gtkmm-list/2013-August/msg00135.html )
Regards,
Markus
Makus. As always I appreciate your taking the time to give input.
The lines that you quote are almost identical to the lines in the
documentation, HelloWorld (the first example of the Gtkmm
documentation). It's totally modeled after Alan's submission of which I
linked to. The only difference is Alan's submission uses the label
widget and the one you're quoting above uses textview. I could be wrong
and you might see something else subtle that I'm missing. If you could
specify specifically I'll message Alan for help to make whatever change
you suggest, if it would be applicable. But I can't make changes at
this time. It's working perfectly and making changes would brake it.
Again, I'd gladly test any lines that you post and tell you if the code
still works.
-- L. James
--
L. D. James
ljames apollo3 com
www.apollo3.com/~ljames
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]