Re: how to underline the text of a button



Gezim Hoxha wrote:
Hi all.

I'm really new to GTK+ and I need some help with this.

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.)

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);

Paul



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