David Gasa Castell wrote:
Could anyone attach me a little example code that examplifies the using
of the accelerators (especially associated in buttons (GTK_TYPE_BUTTON)
for clicking them) ?
See the sample.
PD: I've seen a lot of code in this distribution list but I don't reach
to understand a lot. I try to execute some but... cannot compile !.
Can you, please, point to it, maybe it have to be fixed ?
-- sample
#include <gtk/gtk.h>
static void
clicked(GtkButton *button)
{
static char *labels[]={"Press <Alt>+_a to activate", "Press <Alt>+_b to
activate"};
static int label=0;
label ^= 1;
g_print("button was clicked\n");
gtk_button_set_label(button, labels[label]);
}
int
main(int argc, char **argv)
{
GtkWidget *window;
GtkWidget *button;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width(GTK_CONTAINER(window), 4);
g_signal_connect(window, "delete-event",
G_CALLBACK(gtk_main_quit), 0);
button = gtk_button_new_with_mnemonic("Press <Alt>+_a to
activate");
gtk_container_add(GTK_CONTAINER(window), button);
g_signal_connect(button, "clicked", G_CALLBACK(clicked), 0);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
sample --
Olexiy
_______________________________________________
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list