Re: Bring a widget to the foreground



Don't do that. Fixed size buffers are evil for string formatting. You better use g_strdup_printf even though this would lead to reallocations. But much better then end up with cropped text.

On 01/02/2011 10:00 PM, jcupitt gmail com wrote:
On 2 January 2011 15:39, John Emmas<johne53 tiscali co uk>  wrote:
To be honest, all I'm trying to do is create a button whose label font can be changed on demand.  I've 
managed to achieve it by using an empty button with a label on top, except that the label doesn't always stay 
on top!

Ah, OK, yes, there's a much simpler technique.

Try something like this:

   txt = "some text to display";
   font = "sans 12";

   snprintf (button_text, 256,
      "<span font_desc=\"%s\" size=\"medium\">%s</span>",
      font, txt);
   gtk_label_set_markup (
     GTK_LABEL (gtk_bin_get_child (GTK_BIN (button))),
     button_text);

Assuming 'button' is a regular gtk button containing a label.

John
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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