Re: [gtk-list] Re: Underline menu Characters
- From: Stefan Ondrejicka <ondrej idata sk>
- To: gtk-list redhat com
- Cc: Dave Reed <dreed capital edu>, GTK mailing list <gtk-list redhat com>
- Subject: Re: [gtk-list] Re: Underline menu Characters
- Date: Wed, 23 Jun 1999 09:58:52 +0200 (MET DST)
On Tue, 22 Jun 1999, Edward March wrote:
Hi,
> I want to underline my menu's 1st character... underscores wont
> work in this example.
>
> Im building my menus using glade0.4.1
> and code looks like this:
>
> mFile = gtk_menu_item_new_with_label ("_File");
> gtk_object_set_data (GTK_OBJECT (TheFinder), "mFile", mFile);
> gtk_widget_show (mFile);
> gtk_container_add (GTK_CONTAINER (menubar1), mFile);
>
> In this case the underline DOES not work any ideas on what
> I can do beside using MenuFactory ?
I am using this code for accelerated menu items :
GtkWidget *menu_item(field , accel_group)
gchar *field;
GtkAccelGroup **accel_group;
{
GtkWidget *item,*label;
guint accelerator_key;
item = gtk_menu_item_new();
label = gtk_accel_label_new(field);
gtk_widget_show(label);
gtk_container_add(GTK_CONTAINER(item) , label);
accelerator_key =
gtk_label_parse_uline (GTK_LABEL (label), field);
if (accelerator_key != GDK_VoidSymbol)
{
if (!*accel_group)
*accel_group = gtk_accel_group_new ();
gtk_widget_add_accelerator (item,
"activate_item",
accel_group,
accelerator_key,
GDK_MOD1_MASK,
GTK_ACCEL_LOCKED);
}
return item;
}
and then after all menu items are created, bind accel_group to toplevel
widget:
gtk_accel_group_attach (accel_group, GTK_OBJECT (toplevel));
Regards,
Stevo.
---
Stefan Ondrejicka <ondrej@idata.sk>
Beethovenova 11, 917 08 Trnava, Slovakia
http://www.idata.sk/~ondrej/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]