Re: On key pulsation, again



On 7/18/05, David Gasa Castell <dgasacas7 hotmail com> wrote:
> Thanks a lot for interest... but, you attached me an example which use an
> other technique (the other): mnemonics. In fact, I'd like to understand the
> use of accelerators (like gtk_widget_add_accelerator()) for clicking
> buttons.

I use something like this when I create a top-level window:

        mywindow->accel_group = gtk_accel_group_new();
        gtk_window_add_accel_group( GTK_WINDOW( win ), mywindow->accel_group );
        g_object_unref( mywindow->accel_group );

where mywindow is a struct I use to carry information about the window.

Later when adding a button to the window I do:

        guint key;
        GdkModifierType mods;

        gtk_accelerator_parse( "<ctrl>z", &key, &mods );
        gtk_widget_add_accelerator( GTK_WIDGET( undo ), "clicked",
                mywindow->accel_group, key, mods, 0 );

John



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