Unix Programming - gtk labels

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > April 2007 > gtk labels





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author gtk labels
ranger

2007-04-29, 1:21 am

'm in the process of making a frontend for one of my programs. I want
to use a label to print updates to the user. When environmental
variables change, I alert the user, but I use g_print and output it to
the command line. I want to know how to print this output to a label
instead.

I've heard that one way of doing it is by using gtk_label_set_text(),
but I'm unsure how to direct the output of g_print to the label.

A short example would be great.

Thanks.

James Antill

2007-04-29, 7:16 pm

On Sat, 28 Apr 2007 21:03:31 -0700, ranger wrote:

> 'm in the process of making a frontend for one of my programs. I want to
> use a label to print updates to the user. When environmental variables
> change, I alert the user, but I use g_print and output it to the command
> line. I want to know how to print this output to a label instead.
>
> I've heard that one way of doing it is by using gtk_label_set_text(),
> but I'm unsure how to direct the output of g_print to the label.


g_print isn't what you should be using, although you could hack it using
g_set_print_handler:

http://www.gtk.org/api/2.6/glib/gli...ns.html#g-print
http://www.gtk.org/api/2.6/glib/gli...t-print-handler

....the best thing to do is start using g_strdup_printf:

http://www.gtk.org/api/2.6/glib/gli...g-strdup-printf

....and then either setting the output to a label or the console.

--
James Antill -- james@and.org
http://www.and.org/and-httpd/ -- $2,000 security guarantee
http://www.and.org/vstr/
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com