Is there a way to mark shortcut key with underline?

Hi,

I’m using the following function, gtk_button_new_with_mnemonic, and it states in the documentation:

If characters in label are preceded by an underscore, they are underlined.

But my program currently doesn’t underline the character. Is there something else I might be missing to have the underlining appear on the button? Alt-q works for quitting the program, but why isn’t it showing the underlined character?

button = gtk_button_new_with_mnemonic ("_Quit");
g_signal_connect (button, "clicked", G_CALLBACK (gtk_main_quit), NULL);

This is running on Linux:

$ uname -a
Linux mycomp 5.11.15-arch1-2 #1 SMP PREEMPT Sat, 17 Apr 2021 00:22:30 +0000 x86_64 GNU/Linux

I’m currently using GTK3, not sure if this forum is only for GTK4. Sorry if it is.

Ty

Ok, it wasn’t listed anywhere, and it really is bad behaviour (IMO).

Turns out the character only gets underlined when the alt key is pressed. So you wouldn’t think to try the alt key, because you don’t see an underlined character suggesting a shortcut key.

Is there a way to have the underline displayed, regardless if the alt key is depressed?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.