Accelerators & static link



        Hi there,

        This might be the couple of stupid questions ever but
        I need to ask so... ;)

        1.- How do I got the keyboard accelerators to work?

        I did something like this:
[ Code ]
void
makemenubar( GtkWidget  * parent )
{
        GtkWidget * menubar,
                  * filemenuitem, * file_menu, * quit_item,
        GtkAccelGroup * accel_group;

        accel_group = gtk_accel_group_new();
        gtk_accel_group_attach( accel_group, GTK_OBJECT(parent) );

        /*
         * File Menu
         */
        file_menu = gtk_menu_new();

        quit_item = gtk_menu_item_new_with_label( "Exit" );
        gtk_menu_append( GTK_MENU(file_menu), quit_item );
        gtk_signal_connect( GTK_OBJECT(quit_item), "activate",
                        GTK_SIGNAL_FUNC(gtk_main_quit), NULL );
        gtk_widget_show( quit_item );
        gtk_widget_add_accelerator( quit_item, "activate", accel_group, 'x',
                        GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE );

        filemenuitem = gtk_menu_item_new_with_label( "File" );
        gtk_widget_show( filemenuitem );
        gtk_menu_item_set_submenu( GTK_MENU_ITEM(filemenuitem), file_menu );

        /*
         * Main Menu Bar
         */
        menubar = gtk_menu_bar_new();
        gtk_box_pack_start( GTK_BOX(parent), menubar, FALSE, FALSE, 0 );
        gtk_widget_show( menubar );

        gtk_menu_bar_append( GTK_MENU_BAR(menubar), filemenuitem );
}
[...]

        But it doesn't seem to work... :(

        2.- How do I link statically the program?

        Thanks in advance.
        Cheers.

-- 
        n = ((n >>  1) & 0x55555555) | ((n <<  1) & 0xaaaaaaaa);
        n = ((n >>  2) & 0x33333333) | ((n <<  2) & 0xcccccccc);
        n = ((n >>  4) & 0x0f0f0f0f) | ((n <<  4) & 0xf0f0f0f0);
        n = ((n >>  8) & 0x00ff00ff) | ((n <<  8) & 0xff00ff00);
        n = ((n >> 16) & 0x0000ffff) | ((n << 16) & 0xffff0000);
                     - Código en C que invierte los bits en una palabra.





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