Re: Problem with clist
- From: johnsjam comcast net
- To: gtk-app-devel-list gnome org
- Subject: Re: Problem with clist
- Date: Tue, 06 Jul 2004 18:57:43 +0000
With a quick glance, it looks to me like you are dereferencing a pointer to a pointer. Try the following:
gtk_clist_append ((GtkCList *)clist, data[i]);
Instead of:
gtk_clist_append ((GtkCList *)clist, &data[i]);
Jimmy
-------------- Original message --------------
I've got a clist which shows a dialog when you select an item, the
problem is that when you click on an entry in the list the dialog
freezes - it's ok if you use the arrow keys.
Seems to be a combination of GTK_SELECTION_BROWSE and the fact that the
dialog is modal.
I've attached a sample program which shows the problem. Not sure if I'm
doing something wrong or if it's a gtk bug.
Jon
----------------------------------------------------------------------
#include
void selection(GtkWidget *clist, gint row, gint column, GdkEventButton
*event, gpointer data)
{
GtkWidget *pwDialog, *pwBut;
pwDialog = gtk_dialog_new();
pwBut = gtk_button_new_with_label( ("Try to click me") );
gtk_container_add( GTK_CONTAINER( GTK_DIALOG( pwDialog )->vbox ), pwBut
);
gtk_signal_connect_object( GTK_OBJECT( pwBut ), "clicked",
GTK_SIGNAL_FUNC( gtk_widget_destroy ), GTK_OBJECT( pwDialog ) );
gtk_window_set_modal( GTK_WINDOW( pwDialog ), TRUE );
g_signal_connect(G_OBJECT(pwDialog), "destroy",
G_CALLBACK(gtk_main_quit), NULL);
gtk_widget_show_all( pwDialog );
gtk_main();
}
int main(int argc, char *argv[])
{
int i;
char *data[4] = {"Milk", "Water", "Carrots", "Snakes"};
GtkWidget *window, *clist;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK
(gtk_main_quit), NULL);
clist = gtk_clist_new_with_titles (1, NULL);
for (i = 0; i < 4; i++)
gtk_clist_append ((GtkCList *)clist, &data[i]);
gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_BROWSE);
g_signal_connect(G_OBJECT (clist), "select_row", G_CALLBACK
(selection), NULL);
gtk_container_add(GTK_CONTAINER(window), clist);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
_______________________________________________
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]