resizep




I want a clist to comeup large enough to hold the
text in it (actually larger, but will settle with that
for now).  Here is the test code ?  (I think that this
is as simple as resizing the holding window).

thanks for the help,
newbie

#include <gtk/gtk.h>

int
main (int argc, char *argv[])
{
  GtkWidget *window = NULL;
  GtkWidget *clist = NULL;
  static char *titles[] = {"Package Name",
			   "Short Description"};
  static char *row1[] = {"Row1", "Desc of 1" };
  static char *row2[] = {"Row2", "Desc of 2" };
  static char *row3[] = {"Row3", "Desc of 3" };

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_container_border_width (GTK_CONTAINER (window), 0);

  clist = gtk_clist_new_with_titles (2, titles);
  gtk_clist_set_column_width (GTK_CLIST (clist), 1, 150);
  gtk_clist_set_column_width (GTK_CLIST (clist), 2, 450);
  gtk_clist_column_titles_active (GTK_CLIST (clist));
  gtk_clist_append (GTK_CLIST (clist), row1);
  gtk_clist_append (GTK_CLIST (clist), row2);
  gtk_clist_append (GTK_CLIST (clist), row3);

  gtk_clist_set_policy (GTK_CLIST (clist),
			GTK_POLICY_AUTOMATIC,
			GTK_POLICY_AUTOMATIC);
  gtk_clist_set_selection_mode (GTK_CLIST (clist),
				GTK_SELECTION_BROWSE);
  gtk_clist_set_column_justification (GTK_CLIST (clist),
				      0, GTK_JUSTIFY_RIGHT);

  gtk_container_add (GTK_CONTAINER (window), clist);
  gtk_widget_show (clist);
  gtk_widget_show (window);

  gtk_main ();

  return 0;
}



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