Re: [gtk-list] horizontal scrolling incorrectly with scrolled window



gandalf@pobox.com wrote:

> Here is a code snippet which creates a scrolled window and a clist, and
> then sets the scrolling in both directions to automatic.  The vertical
> has no problems, but the horizontal is all wacked out:
> 
> listTitles[0] = g_malloc(sizeof(gchar) *13 );listTitles[0] = "Machine\0";
> machinelist  =  gtk_clist_new_with_titles( 1, listTitles);
> gtk_clist_set_column_width( GTK_CLIST (  machinelist),0,45);
> machineframe = gtk_scrolled_window_new(NULL, NULL);
> gtk_container_add(GTK_CONTAINER(machineframe), machinelist);
> gtk_box_pack_start(GTK_BOX(hbox), machineframe, TRUE, TRUE, 0);
> gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (machineframe),
>                                 GTK_POLICY_AUTOMATIC,
>                                 GTK_POLICY_AUTOMATIC);
> gtk_widget_show(machineframe);
> gtk_widget_show(machinelist);

You've set the column width explicitly to 45.
What you probably want to do is call one of the CList's resize functions
to set the column width based on the contents, i.e. call
gtk_clist_columns_autosize(clist) after creating it.

Damon




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