Re: [gtk-list] Re: GtkCList question



Hajba Szilard wrote:
> 
> > Typically, you need to calculate the size of each data row yourself,
> > based on the pixel height of the font and any padding added above and
> > below each row's text.  I think you can get this out of GtkStyle.
> > 
> > With regards to turning off scroll, Gtk+ doesn't provide a "SCROLL_NONE"
> > policy I don't think, though I wish it did.  :)  Turning off scroll is a
> > bad idea anyway, unless your data absolutely, positively will fit on a
> > single screen -- even if the user is running 640x480.
> 
> My data will absolutely fit on the screen, because my CList has only
> constant number of rows. I will do scrolling myself with
> gtk_clist_set_text(). It's not a nice solution i know, but i have no other
> idea. I can't load >10000 records into a CList. I think, GTK should
> support this sort of lists (lists with a callback function to access
> databases), but I don't have enough time to write it now.

If you have that small an amount of data and want to scroll manually,
maybe do something like

	gtk_clist_freeze()	/* disable screen updates */
	gtk_clist_clear()	/* erase entire list */
	gtk_clist_append()	/* add data item 1 */
	gtk_clist_append()	/* add data item 2 */
	...			/* ... */
	gtk_clist_thaw()	/* update screen w/ new contents */

Of course, if you are only scrolling one or two rows at a time, you'll
want to make that look something more like (scroll down two rows):

	gtk_clist_freeze()	/* disable screen updates */
	gtk_clist_clear()	/* erase entire list */
	gtk_clist_remove(clist, 0) /* remove first data item */
	gtk_clist_remove(clist, 0) /* remove first data item */
	gtk_clist_append()	/* add new data item 1 */
	gtk_clist_append()	/* add new data item 2 */
	gtk_clist_thaw()	/* update screen w/ new contents */

Jeff





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