Re: How to add accel key without button?
- From: Antonio Gomes <tonikitoo gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: How to add accel key without button?
- Date: Tue, 1 Feb 2005 11:19:04 -0400
Hello Huang,
And wanna to complement your question ... could i ?!
How can I use accels without any other widgets related with it (like
buttons or menu itens) ?! So, if I hava just a main window, and I
press "ctrl + F", for example, an event is fired, calling the
correspondent callback !?
Thanks in advance ...
PS: Sorry for my not pretty english ;)
--
Antonio Gomes
Embedded Linux Developer
Embedded Linux Lab - 10LE
INdT - Instituto Nokia de Tecnlogia
Manaus/Br
On Tue, 01 Feb 2005 11:48:23 +0800, Falls Huang <bhuang qubit-star com> wrote:
Hello!
I saw many guys use such code to add an accelerator key :
/**************************************/
GtkWidget *window , *button;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
button = gtk_button_new_with_label ("Hello World");
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK ,
(gtk_main_quit),NULL);
GtkAccelGroup *accel = gtk_accel_group_new();
gtk_widget_add_accelerator(button,"clicked",accel, GDK_q ,0 ,
GTK_ACCEL_VISIBLE);
gtk_container_add (GTK_CONTAINER (window), button);
gtk_window_add_accel_group(GTK_WINDOW(window),accel);
gtk_widget_show(button);
gtk_widget_show(window);
/**************************************/
The accelerator key works well.
But I don't want to see a button in my window ,so I changed to :
/**************************************/
GtkWidget *window;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK ,
(gtk_main_quit),NULL);
GtkAccelGroup *accel = gtk_accel_group_new();
gtk_widget_add_accelerator(window,"clicked",accel, GDK_q ,0 ,
GTK_ACCEL_VISIBLE);
gtk_window_add_accel_group(GTK_WINDOW(window),accel);
gtk_widget_show(window);
/**************************************/
When I ran this code , it give me warning :
(helloworld:4814): Gtk-WARNING **: gtkwidget.c:3076: widget `GtkWindow'
has no activatable signal "delete_event" without arguments
How can I connect the accelerator key(GDK_q) to "delete_event" signal ?
--
Regards
Falls Huang
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]