Re: how to underline the text of a button [solved]



On Mon, 2006-27-02 at 00:50 +0200, Paul Pogonyshev wrote:
Gezim Hoxha wrote: 
I have a button like this:
GtkButton *pulse_button
pulse_button = g_object_new (GTK_TYPE_BUTTON, 
                            "label", "_Pulse",
                            "use-underline", TRUE,
                            NULL);

And I want to know why isn't the word "Pulse" underlined in the button
text?

It shouldn't.  When you create a button like this, letter `P' will be
underlined and the user will be able to activate the button from the
keyboard with Alt+P (and with mouse too, of course.)

Heh, I realized this after I emailed the list.


If you really need underlined text in a button, try

  GtkWidget *pulse_button = gtk_button_new ();
  GtkWidget *pulse_label  = gtk_label_new ();

  gtk_label_set_markup (GTK_LABEL (pulse_label), "<u>Pulse</u>")
  gtk_container_add (GTK_CONTAINER (pulse_button), pulse_label);

Thanks for this. Line two of the code doesn't work though because there
needs to be an argument when gtk_label_new is called, this worked
however:
  GtkWidget *pulse_label  = gtk_label_new ("Temp Text");

Thanks,
-Gezim




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