[9810] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Re: GtkCList question

daemon@ATHENA.MIT.EDU (Jeff Garzik)
Tue Nov 3 15:56:41 1998

To: gtk-list@redhat.com
Date: Tue, 3 Nov 1998 15:59:10 -0500 (EST)
Reply-To: jgarzik@pobox.com
In-Reply-To: <Pine.LNX.3.96.981103172625.12837A-100000@genius.revai.hu> from "Hajba Szilard" at Nov 3, 98 05:27:27 pm
From: Jeff Garzik <jgarzik@pobox.com>
Resent-From: gtk-list@redhat.com

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



-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post