Re: [gtk-list] Re: Clist within scrolled window
- From: Kent Schumacher <kent structural-wood com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Clist within scrolled window
- Date: Mon, 25 Oct 1999 15:23:02 -0500
Federico Mena Quintero wrote:
> > Agreed, but making that change does not make gtk_clist_moveto work correctly.
> > One of the problems is that the 'upper' value in the vertical adjustment in gtk_clist
> > is not updated as entries are added to the clist.
>
> Huh? It *is* updated. real_insert_row() calls adjust_adjustments()
> if the clist is not frozen.
>
> (If the clist is frozen, there's no point in calling gtk_clist_moveto() anyways).
>
> Or do you have a simple test program that exposes the bug?
>
> Federico
>
Sorry about that - here is a little program. Your clause about being
frozen got me thinking about widget states; I played around and it appears
that scrolling is dependent on the the parent container(s) being shown.
This seems non-intuitive to me. I can imagine cases where it might be
a problem to work around this behavior as well.
Thanks for the quick responses on this problem.
Kent
#include <stdio.h>
#include <gtk/gtk.h>
#define SHOW_ODDITY (0)
int main(int argc, char *argv[]) {
GtkWidget *window,*clist,*scroll;
int i;
char buf[20];
char *entry[1];
gtk_init(&argc,&argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
scroll = gtk_scrolled_window_new(NULL,NULL);
clist = gtk_clist_new(1);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
gtk_clist_set_column_auto_resize(GTK_CLIST(clist),0,TRUE);
entry[0] = buf;
for (i = 1000 ; i < 1100 ; i++) {
sprintf(buf,"%d",i);
gtk_clist_append(GTK_CLIST(clist),entry);
}
gtk_container_add(GTK_CONTAINER(scroll),clist);
gtk_container_add(GTK_CONTAINER(window),scroll);
gtk_widget_show(clist);
gtk_widget_show(scroll);
if (! SHOW_ODDITY) {
gtk_widget_show(window);
}
gtk_clist_select_row(GTK_CLIST(clist),30,0);
gtk_clist_moveto(GTK_CLIST(clist),30,0,0.5,0.5);
if (SHOW_ODDITY) {
gtk_widget_show(window);
}
gtk_main();
return(0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]