this old Clist bug...



Hello

It seems that I have located the bug in the clist I was talking about a
few time ago :

When the titles of the clist are passives, and if you use
gtk_widget_set_sensitive on the list to false, everything is ok.

But if you want to set the sensitvity to TRUE, then the sensitivity of
the titles isn't correctly set.

here follow a small example that shows the wrong behaviour.

Goodbye

------------- Cut Here :)--------------------------------


#include <stdio.h>
#include "/opt/gtk/include/gtk/gtk.h"



GtkWidget *clist;


void sensitive(GtkWidget *,gpointer);



gint delete_event( GtkWidget *widget,
     GdkEvent  *event,
     gpointer   data )
{
  return(FALSE);
}

/* Another callback */
void destroy( GtkWidget *widget,
       gpointer   data )
{
  gtk_main_quit();
}

int main( int   argc,
   char *argv[] )
{

  GtkWidget *window;
  GtkWidget *button,*note,*label;
  GtkWidget *scroll,*vb,*vb2,*hb;

  gchar *clabel[]={"ID1","ID2","ID3"};
  gchar *crow[]={"3","4","5"};
  gint i;



  gtk_init(&argc, &argv);


  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);


  gtk_signal_connect (GTK_OBJECT (window), "delete_event",
        GTK_SIGNAL_FUNC (delete_event), NULL);


  gtk_signal_connect (GTK_OBJECT (window), "destroy",
        GTK_SIGNAL_FUNC (destroy), NULL);

  gtk_container_border_width (GTK_CONTAINER (window), 10);






  vb2=gtk_vbox_new(FALSE,20);
  vb=gtk_vbox_new(FALSE,0);

  clist=gtk_clist_new_with_titles(3,clabel);
  gtk_widget_set_usize(clist,300,50);
  gtk_clist_column_titles_passive(GTK_CLIST(clist));


  gtk_widget_show(clist);

  scroll=gtk_scrolled_window_new(NULL,NULL);
  gtk_widget_set_usize(scroll,520,500);

gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);

  gtk_container_add(GTK_CONTAINER(scroll),clist);
  gtk_widget_show(scroll);


  gtk_box_pack_start(GTK_BOX(vb),scroll,FALSE,FALSE,0);

  gtk_widget_show(vb);

  gtk_box_pack_start(GTK_BOX(vb2),vb,FALSE,FALSE,0);

  hb=gtk_hbox_new(TRUE,0);

  button=gtk_button_new_with_label("True");

gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(sensitive),(gpointer)TRUE);

  gtk_widget_show(button);
  gtk_box_pack_start(GTK_BOX(hb),button,FALSE,FALSE,0);

  button=gtk_button_new_with_label("False");

gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(sensitive),(gpointer)FALSE);

  gtk_widget_show(button);
  gtk_box_pack_start(GTK_BOX(hb),button,FALSE,FALSE,0);

  gtk_widget_show(hb);
  gtk_box_pack_start(GTK_BOX(vb2),hb,FALSE,FALSE,0);

  gtk_widget_show(vb2);

  gtk_container_add(GTK_CONTAINER(window),vb2);

  gtk_widget_show(window);



  gtk_main ();

  return(0);
}
void sensitive(GtkWidget *widget,gpointer data)
{
    gtk_widget_set_sensitive(clist,(gint)data);

}


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