Re: [gtk-list] Underlining in menu's



Jack L Calaway wrote:
> 
> G'day:
> 
>   How do I underline a character in a menu label when using these functions:
> 
>     gtk_menu_item_new_with_label()
>     gtk_check_menu_item_new_with_label()
>     gtk_radio_menu_item_new_with_label()
>     gtk_menu_item_new_with_label()
>     gtk_menu_item_new_with_label()
> 
>   IE: is there a function like "gtk_label_set_pattern()" for menu's?

You do something like this:

	GtkAccelGroup *menu_accel_group;
	guint accel_key;

	menu_accel_group = gtk_menu_ensure_uline_accel_group (GTK_MENU (menu));

	menuitem = gtk_check_menu_item_new_with_label ("");
	accel_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menuitem)->child),
                                           _("Show _Only Working Hours"));
	gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
				    accel_key, 0, 0);


Using GtkItemFactory may be easier.

Damon




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