Re: [gtk-list] using accelerator keys - how?



On 20 Mar, Nathan Froyd shouted:
->  Could somebody fill me in on how the accelerator key stuff works in
->  GTK+? For example, how would I implement the key press '1' to toggle a
->  check box? Or a key press of C-g to increment a scrollbar by 16?
->  
->  Thanks!
->  Nathan
->  
   edit_accel=gtk_accelerator_table_new();
   gtk_window_add_accelerator_table(GTK_WINDOW(window_edit),edit_accel);
   gtk_accelerator_table_install(image_accel,
                                 GTK_OBJECT(window_image),"delete_event",
                                 'q',0);

that makes the q key delete the wwindow :)
(window_image is a GtkWindow)

you may wish to change "delete_event" to "clicked" (for the signal to
send to that widget).
-- 
--------------- Codito, ergo sum - "I code, therefore I am" --------------------
raster@rasterman.com       /\___ /\ ___/||\___ ____/|/\___  raster@redhat.com
Carsten Haitzler           | _ //__\\ __||_ __\\ ___|| _ /  Red Hat Advanced
218/21 Conner Drive        || // __ \\_ \ | |   \ _/_|| /   Development Labs
Chapel Hill NC 27514 USA   ||\\\/  \//__/ |_|   /___/||\\   919 547 0012 ext 282
+1 (919) 929 9443, 801 4392   For pure Enlightenmenthttp://www.rasterman.com/ 



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