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

2013-08-19 Thread Markus Elfring
 Do you see any technical problems with what I posted?

Eventually, yes.

It depends on the observed execution speed in your application for example. When
would you categorise the situation that a specific graphical user interface
becomes unresponsive?
Do you expect visual feedback in less than a second for your programs?


 Do you think you could make it more efficient?

There are more aspects to consider besides efficiency. How do you think about to
apply the design pattern Model-View-Controller?
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller


 Then, instead of writing three lines to update the gui window, I'd
 be able to type:
 
 gprint(Updated text);

Such a desire is fine until you clarify a few more implementation details.

Regards,
Markus
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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

2013-08-19 Thread L. D. James

On 08/19/2013 02:28 AM, Markus Elfring wrote:

Do you see any technical problems with what I posted?

Eventually, yes.

It depends on the observed execution speed in your application for example. When
would you categorise the situation that a specific graphical user interface
becomes unresponsive?
Do you expect visual feedback in less than a second for your programs?
The program executes.  The gui is updated in a faction of a second. If I 
placed a left a button there as I find in most of the examples it would 
take longer to see the update because a person can't press a button in 
less than a faction of a second.


But again, my code doesn't experience any delay that I can identify.  
The output is just as immediate as I can see as if it were output with 
cout to standard out.


As far as you seeing a technical problem, is it possible that you could 
post some code that would actually work to identify the problem?


Also do you see the same problem with the code supplied by Alan and 
discussed in depth here:

https://mail.gnome.org/archives/gtkmm-list/2013-August/msg00052.html

I tried to model my code based on what I learned from there and from 
what Kjell provided, as well as everything I can see in the 
documentation.  I don't understand how it differs from Alan's code 
except mainly that I change it from the Label widget to a textview widget.


I was hoping to have the simplest example so that I could use the 
example to test various widgets and get a good grip on how to build my own.



Do you think you could make it more efficient?

There are more aspects to consider besides efficiency. How do you think about to
apply the design pattern Model-View-Controller?
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller



I studied the link you provided above.  I can't say I fully understand 
it.  I had studied it before I asked the group for help, of which I 
received Alan's example that worked.



Then, instead of writing three lines to update the gui window, I'd
be able to type:

gprint(Updated text);

Such a desire is fine until you clarify a few more implementation details.
I don't currently know how to implement the gprint() goal.  But I'm 
working on it.  When my current position is clean enough for a 
discussion I will present it in a different thread, unless someone else 
sees the answer while reading this thread and brings it up.


Currently if the lines of code that I have already posted could be 
improved that would satisfy the namesake of this thread.  Of course if I 
could see some code example of the problem that you're describing with 
my current code, that would be great!  I'd be glad to work with it and 
see the functionality.  But so far all the technical suggestions that 
I'm getting appears to actually already be implemented in the 47 lines 
of code that I published.


-- L. James

--
L. D. James
lja...@apollo3.com
www.apollo3.com/~ljames
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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

2013-08-19 Thread Markus Elfring


As far as you seeing a technical problem, is it possible that you 
could post some code that would actually work to identify the problem?


Your function HelloWorld::cpp_app indicated in this example that it 
will execute for some seconds. I got doubts that the graphical user 
interface will be as responsive as you might expect it.
A well-known approach is to perform long lasting data processing in a 
dedicated thread which is separate from the one which serves the user 
interface. You need to be very careful with synchronisation so that you 
avoid thread-unsafe data accesses.

http://en.wikipedia.org/wiki/Synchronization_%28computer_science%29



I can't say I fully understand it.


Do you like a different description about GUI architectures?
http://martinfowler.com/eaaDev/uiArchs.html

Regards,
Markus
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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

2013-08-19 Thread L. D. James

On 08/19/2013 05:22 AM, Markus Elfring wrote:


As far as you seeing a technical problem, is it possible that you 
could post some code that would actually work to identify the problem?


Your function HelloWorld::cpp_app indicated in this example that it 
will execute for some seconds. I got doubts that the graphical user 
interface will be as responsive as you might expect it.
A well-known approach is to perform long lasting data processing in a 
dedicated thread which is separate from the one which serves the user 
interface. You need to be very careful with synchronisation so that 
you avoid thread-unsafe data accesses.

http://en.wikipedia.org/wiki/Synchronization_%28computer_science%29
Thanks, Markus.  While I can't understand what you're suggesting, I 
really appreciate the input as well as the specifics.  I have all the 
documentations that the users from the list has given me.  I'm studying 
all of it.  It's a lot for a novice.  But I'm not taking any of it light.


Most of the details don't have examples that I can test and I'm spending 
a lot of time cross referencing trying to understand the terms in the 
technical documentations.


As far as the function executing for some seconds, it executes for 
fractions of a second, minutes, hours, perfectly totally as I expect as 
well as totally as desired.


As far as I can see, the function that you picked out is the exact 
function that was provided to me by Alan, and discussed by a number of 
the professionals in this mail list as being functional.  The only 
difference as I can see is the name.  I took Alan's code and tried to 
learn it in such that I could rewrite it and give descriptive names 
according to what I was looking for the function to do.


I also changed the widget from label to textview.

Can you tell me what is different between the two functions:

My example:
HelloWorld::cpp_app

Alan's example:
myLabel::myprocess1

By the way, I left the HelloWorld part because I was trying to keep it 
as consistent with the example in the documentation tutorial as 
possible.  The class and function names are different in my actual 
application.  I'm able to make this differences because (I thought) I 
had come to understand what Kjell and Alan had given me.


I'm not good enough to read the highly technical links that you're 
providing me with to make radical changes to the code at this point.  
Kjell recognized the tutorial conatains a chapter on multi-threaded 
programs (from this message:

New multi-threaded example program in the gtkmm tutorial:
https://mail.gnome.org/archives/gtkmm-list/2013-August/msg00055.html

He indicated that it lacked  an example.  The lack of example makes it 
hard for a novice to grasp (as in my case).  So after Alan's assistance, 
which actually resolved my issue, Kjell added a tutorial with an 
example, which I tried to model my code after.


If there is a difference between Alan's code and my updated version, I'd 
appreciate knowing the difference.  I still wouldn't be able to change 
it without an example of the specific lines that would fix it.  Any 
changes that I made will actually brake the code and the gui window 
would lost it's responsiveness, or not display at all.


This was happening when I simply tried to change Alan's code from a 
label widget to a textview widget.  The lost of functionality was the 
purpose of this thread.  I was hoping to see the bare essentials.  I 
thought, after many hours that I had found the key (studying Alan's and 
Kjell's examples).


I'm studying in detail the links that you're providing, but I can't see 
from those links what specific I should change and still have the code 
function as desired.


-- L. James

--
L. D. James
lja...@apollo3.com
www.apollo3.com/~ljames





I can't say I fully understand it.


Do you like a different description about GUI architectures?
http://martinfowler.com/eaaDev/uiArchs.html

Regards,
Markus


___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Conflict between windows.h and giomm/dbusmessage.h (2)

2013-08-19 Thread Jonas Platte
I already answered to your previous mail, I don't know why you didn't 
receive my reply.
But you can read it on the mail archive: 
https://mail.gnome.org/archives/gtkmm-list/2013-August/msg00115.html


Am 18.08.2013 15:19, schrieb John Emmas:

On 15/08/2013 10:20, John Emmas wrote:


I discovered this problem while building with VC++8.  Maybe someone 
can confirm if it also affects later versions of MSVC?


#include windows.h
#include giomm.h  // ( or alternatively, #include 
giomm/dbusmessage.h )


Creating a source file with just those 2 lines gives me the following 
compiler error:-


dbusmessage.h(353) : error C2332 'struct' : missing tag name

Line 353 of 'dbusmessage.h' looks like this:-

static Glib::RefPtrMessage create_signal(const 
Glib::ustring path, const Glib::ustring interface, const 
Glib::ustring signal);


I think it's the use of the name interface that's causing the 
conflict.  In my VC IDE, the word interface gets printed in blue 
which usually indicates that it's a reserved word.




Sorry to bump this but is anyone looking into it?  A few minutes ago I 
discovered that even the following 2 lines will fail if compiled in 
Debug mode:-


#define  _CRTDBG_MAP_ALLOC
#include gtkmm.h

It's becoming near impossible to build glibmm and gtkmm using MSVC any 
more.  I honestly think someone should be assigned to investigate 
these problems before too many of them creep in... :-(


John

___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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

2013-08-19 Thread Markus Elfring
 I'm studying in detail the links that you're providing, but I can't see
 from those links what specific I should change and still have the code
 function as desired.

I'm curious when you start playing around with software design extensions for
your small program example.   ;-)

Regards,
Markus
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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

2013-08-19 Thread L. D. James

On 08/19/2013 11:50 AM, Markus Elfring wrote:

I'm studying in detail the links that you're providing, but I can't see
from those links what specific I should change and still have the code
function as desired.

I'm curious when you start playing around with software design extensions for
your small program example.   ;-)

Regards,
Markus
I don't know what you mean by design extensions.  But I started out 
programming in assmebly language in the Late 70's.  I went to C in the 
early 80's.  It was all in DOS, not Windows.  In the late 90's I started 
using a semi graphical interface by programming perl CGI. I also 
started using Visual C++ and the MFC environment around that time.


Maybe it's the MFC that you're referring to in playing around with 
software design extensions.  For MFC in Visual Studio you basically just 
draw a box, then output your text to that box with a single line (much 
like the gprint function I want to design for gtkmm/C++).


In around 2005 I started programming in Java (no gui).  Then around 2010 
I started programming in Java GUI.  In 2011 I started programming for 
the Android.  The interface basically used  a screen for drawing the 
window, then a single line to update the text in the window.  I started 
doing the same with Java Applications and Java Applets early this year.


Last month I started trying to do the same thing that I was doing with 
Java (Applications, Applets, and the Android) with C++ via Gtkmm... thus 
hear I am.


So, I'm not new to programming, but playing around with software 
design extensions is probably something new.


Somewhere in between those stages I played with python, mono, and a few 
other languages.  But I never did much productive work, just experiments 
with them.


All the others has easy ways of updating the gui window.  At first Gtkmm 
appeared to be the only interface that didn't have an easy way to update 
the gui window with new text.  The more I play with it, the more it 
appears to be rather easy.  I don't believe it's as complicated as many 
appears to be saying it is.  Looking at most of Alan's messages I 
believe he gave me most of the code from his phone while he was 
traveling.  A couple of times he asked me to wait a couple of days while 
he got to his computer so the he could run some test.


So, most likely the best answer is that I'm just starting out, playing 
with software design extensions... maybe in the most definitive terms, I 
might not have quiet started out yet.  I'm mainly just using the simple 
lines of code provided to me by Alan and Kjell and sending text to the 
gui window.


At present it's working perfectly.  Basically I just want to display 
text to my clients in some manner that it doesn't appear as if the OS is 
broken.  Most of the times when I ask a client to read to me what they 
see, when they see a black screen, they say they don't see anything.  It 
takes a while for them to realize the black screen has usable 
information.  I'm starting to send the same text to a graphical window.  
My clients has no problems reading that screen and relating to me what 
they see.


-- L. James

--
L. D. James
lja...@apollo3.com
www.apollo3.com/~ljames
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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

2013-08-19 Thread John Emmas

On 19/08/2013 19:38, L. D. James wrote:


I'm not new to programming, but playing around with software design 
extensions is probably something new.


Somewhere in between those stages I played with python, mono, and a 
few other languages.  But I never did much productive work, just 
experiments with them.


All the others has easy ways of updating the gui window.  At first 
Gtkmm appeared to be the only interface that didn't have an easy way 
to update the gui window with new text.  The more I play with it, 
the more it appears to be rather easy.  I don't believe it's as 
complicated as many appears to be saying it is.




Although it won't help you directly with gtkmm, I would HIGHLY recommend 
you to buy Andrew Krause's book Foundations of GTK+ development.  I 
came from a background with MFC and quite frankly, I found GTK+ to be 
plain weird after the simplicity of MFC.  However I found it much easier 
to understand GTK+ after reading Andrew's excellent book.  Any good 
technical bookshop should be able to get it for you.


John
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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

2013-08-19 Thread Markus Elfring
 I don't know what you mean by design extensions.

I find that strange to some degree ...


 But I started out programming in assmebly language in the Late 70's. I went
 to C in the early 80's.  It was all in DOS, not Windows.  In the late 90's
 I started using a semi graphical interface by programming perl CGI. I also
 started using Visual C++ and the MFC environment around that time.

I assume that you are used to the selection and application of design patterns
if you mention such a long software development experience.
http://en.wikipedia.org/wiki/Software_design_pattern


 Most of the times when I ask a client to read to me what they see, when they 
 see
 a black screen, they say they don't see anything.  It takes a while for them
 to realize the black screen has usable information.

How do you think about any fine-tuning for text colours in your log console?

Might a Curses-based user interface also be sufficient for your use case?
http://en.wikipedia.org/wiki/Curses_%28programming_library%29

Regards,
Markus
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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

2013-08-19 Thread L. D. James

On 08/19/2013 04:18 PM, Markus Elfring wrote:

I don't know what you mean by design extensions.

I find that strange to some degree ...


I've mentioned numerous times that I have some glitches in my 
experience.  I never took up formal education in programming.  I studied 
business and accounting in college.  I'm self taught in programming.


While I'm self-taught, I do tutor college students who has come to me, 
often, when they were failing and getting D's.  With my assistance it 
always changes to A's.  The owner of one of the most prominent entities 
on the web was tutored by me.


But, yes.  I have some real glitches.  Some of the gaps are being filled 
in by the discussions of the threads I have started in this maillist.

But I started out programming in assmebly language in the Late 70's. I went
to C in the early 80's.  It was all in DOS, not Windows.  In the late 90's
I started using a semi graphical interface by programming perl CGI. I also
started using Visual C++ and the MFC environment around that time.

I assume that you are used to the selection and application of design patterns
if you mention such a long software development experience.
http://en.wikipedia.org/wiki/Software_design_pattern


Thanks for the definition of software design pattern.  And based on what 
I have just read, I have been using it.  I just never used the term.  I 
also promote this in my tutoring.


I'm sure it's a component of software design pattern of which the 
namesake of this thread is about.  I have a goal of easily updating a 
gui window with new text.  While that code is working fine (as provided 
by Alan), I still look forward to implementing a gprint function to 
consolidate 3 lines into one line.  The code to do that might take 
months and end up being a couple of hundred lines.  Just as, I haven't 
explored the code involved in the function, cout, but I'd be surprised 
if it's less than a couple of hundred lines.


The namesake of this thread is to first understand how to actually 
achieve an update to the gui window, of which I published the code.


You're saying it's broke.  While it appears to work perfectly in every 
way, I'd be glad to see some code that I could test that wouldn't be 
broken according to your expertise.


I sincerely appreciate the jargon that I'm learning in the meantime.

Most of the times when I ask a client to read to me what they see, when they see
a black screen, they say they don't see anything.  It takes a while for them
to realize the black screen has usable information.

How do you think about any fine-tuning for text colours in your log console?

Might a Curses-based user interface also be sufficient for your use case?
http://en.wikipedia.org/wiki/Curses_%28programming_library%29
Every thing you mention can be an enhancement.  The examples in the 
gtkmm documentation has lots of font controls, word wrappings, window 
scrolling and many other features.  The examples were rather confusing 
for me as a beginner.  I'm sure I can add a lot of highlights and 
decorations now.  But I can't emphasis how important I consider having  
the rawest and most basic (blank) slate to begin with.  The absolute 
only thing that matters at this point is for me to actually be able to 
have a gui window and update it with appended or new text.


I'd appreciate some validation from you if I have gotten it right (to be 
able to append text to a blank window), or an example that you consider 
more right than the code assistance I currently have from Alan.


I haven't experimented with colors, but I did very easily change the 
fonts.  I'm sure changing the colors would be just as easy.


My main reason for switching from the label widget of the original code 
from Alan to the textview widget is because in my research it appeared 
that font and text output manipulation was easier with the textview widget.


Thanks!

-- L. James

--
L. D. James
lja...@apollo3.com
www.apollo3.com/~ljames
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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

2013-08-19 Thread L. D. James

On 08/19/2013 05:57 PM, Andrew Potter wrote:

I've changed Example 4 to use a TextView instead of a Label and
renamed report_progress() to gui_print().


Thanks, Andrew.  Your gui_print() function appears to be exactly what I 
was trying to accomplish in my next stage.


At present I'm working with it to make it append the text rather than 
replace the text displayed.


I really appreciate your taking the time to understand the question.

-- L. James

--
L. D. James
lja...@apollo3.com
www.apollo3.com/~ljames
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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

2013-08-19 Thread Gavin Lambert
Quoth Andrew Potter:
 void gui_print(const Glib::ustring str) {
 /* Get a function pointer to the set_text method we want to
  * use. We must explicitly declare the method pointer
  * signature because Gtk::TextBuffer::set_text is an
  * overloaded method. */
 void (Gtk::TextBuffer::*fptr)(const Glib::ustring) =
 Gtk::TextBuffer::set_text;
 
 /* Create a functor that points at the TextBuffer method we
  * want to use. Because tb is a Glib::RefPtr and sigc::mem_fun
  * needs the actual Gtk::TextBuffer object, we must use
  * operator-(). See GNOME Bugzilla #495762. */
 sigc::slotvoid, const Glib::ustring set_text_functor =
 sigc::mem_fun(tb.operator-(), fptr);
 
 /* Bind the arguments of the functor to create a
  * sigc::slotvoid that can be sent to the callback
  * dispatcher.
  */
 sigc::slotvoid bound_functor = sigc::bind(set_text_functor,
 str);
 
 /* callback_dispatcher can execute any sigc::slotvoid on the
  * Main Loop. Since we have one now, send it.
  */
 callback_dispatcher.send(bound_functor);
 }

Given that sigc magic is hard for many people, you might want to simplify
this with a helper method:

// Called from the blocking operation in the worker thread
void gui_print(const Glib::ustring str) {
sigc::slotvoid, const Glib::ustring print_functor =
sigc::mem_fun(this, Example::gui_print_ui);
sigc::slotvoid bound_functor = sigc::bind(print_functor, str);
callback_dispatcher.send(bound_functor);
}

// Called on the UI thread when the worker thread calls gui_print
void gui_print_ui(const Glib::ustring str) {
tb-set_text(str);
}

This would make it easier for people to modify the actual action taken in
gui_print_ui.


___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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

2013-08-19 Thread Andrew Potter
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


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

2013-08-19 Thread Incongruous
I have unsubscribed from this list, please delete me from the list.



-Original Message-
From: gtkmm-list [mailto:gtkmm-list-boun...@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

___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list