GtkCList bug.



Hi,

   First, a note: my english is very poor, I hope you understand what I'm 
trying to say...
   I found a bug on GtkCList widget. You can see it using testgtk, but a 
small patch is needed, so "Insert Row" button inserts new data at row 0.
change the line 3103 (on gtk+-1.0.3):
   gtk_clist_insert (GTK_CLIST (data), clist_selected_row, text);
To:
   gtk_clist_insert (GTK_CLIST (data), 0, text);

   Now run testgtk and choice clist. Go down until the first row is not 
visible, and press "Insert Row" button. You will see no changes. But if you try
 to select a row,  the contents of that row changes (Ok, anything that forces a 
 redraw will change the list contents).
   Inserting on a visible row works Ok. 

   The problem is that we must synchronize in some way the "visible part" with 
the list, this could be made forcing a redraw or modifying clist->voffset to 
reflect the new position. Same problem removing a row (gtk_clist_remove()). 
gtk_clist_append() doesn't have this problem (I hope), because the new row is 
always at the end of the list.

   Below is a patch to fix it. Made against gtk+-1.0.3.
   
   I have another problem: I need the text stored on a PIXTEXT cell. I want to
use gtk_clist_get_pixtext(GTK_CLIST(widget), row, 0, &text, NULL, NULL, NULL),
but I get:

** ERROR **: sigsegv caught

   Looking at gtk_clist_get_pixtext() I see (lines 1115-1118):
    
 /* mask can be NULL */
 *mask = GTK_CELL_PIXTEXT (clist_row->cell[column])->mask;
         
   I think it should be:
    
 /* mask can be NULL */
 if (mask)
   *mask = GTK_CELL_PIXTEXT (clist_row->cell[column])->mask;
                
   Am I Missing something?
   
   Thanks in advance.
   
Linux - Why use Windows, since there is a door?
=============================================================================
: Sangoi Dino Leonardo  :                 You can reach me on               :
: Via Della Roggia 27/2 :         Internet : g1001863@univ.trieste.it       :
: 33013 Gemona, Italy   :     Phone: +39 432 970036   Fax: +39 432 974171   :
=============================================================================

----------------------------- cut here ------------------------------
--- /studenti/g1001863/src/gtk+-1.0.3/gtk/gtkclist.c	Mon May 18 15:11:40 1998
+++ gtkclist.c	Wed May 27 12:46:46 1998
@@ -1298,7 +1298,7 @@
     {
       adjust_scrollbars (clist);
 
-      if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
+      if (row <= ROW_FROM_YPIXEL (clist, clist->clist_window_height))
 	draw_rows (clist, NULL);
     }
 }
@@ -1317,7 +1317,7 @@
   if (row < 0 || row > (clist->rows - 1))
     return;
 
-  was_visible = (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE);
+  was_visible = (row <= ROW_FROM_YPIXEL (clist, clist->clist_window_height));
   was_selected = 0;
 
   /* get the row we're going to delete */




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