Re: Bring a widget to the foreground



I agree, I was just trying to keep it simple.

On Tuesday, 4 January 2011, Jaroslav ÅmÃd <jardasmid gmail com> wrote:
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]