Re: Determining width of a clist entry



Chris Wareham wrote:
> 
> I'm trying to set the width of the columns in a CList using:
> 

In answer to my own query:

  GtkStyle *style;
  gchar *rec[3];

  style = gtk_widget_get_style(GTK_WIDGET(clist));

  gtk_clist_freeze(GTK_CLIST(clist));

  for(li = list; li != NULL; li = g_list_next(li)) {
    Record *r = li->data;

    rec[0] = status;
    rec[1] = jobno;
    rec[2] = r->title;

    printf("%s : width(%d)\n", rec[2],
      gdk_string_width(style->font, rec[2]));

    /* update array of maximum column widths ... */

    gtk_clist_append(GTK_CLIST(clist), rec);
    g_free(r);
  }
  g_list_free(list);

/* set column widths ... */

  gtk_clist_thaw(GTK_CLIST(clist));

-- 
turbo-powered tedium




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