summaryrefslogtreecommitdiff
path: root/examples/clist
diff options
context:
space:
mode:
authorBST 1999 Tony Gale <gale@gtk.org>1999-04-10 12:55:24 +0000
committerTony Gale <gale@src.gnome.org>1999-04-10 12:55:24 +0000
commit9ccee8a3fceef43c61094c3bda953cb5b0db4f90 (patch)
tree420440a349ea0c18af0de87816ff0b4acf151168 /examples/clist
parent42e38e41f7ac42ff4a95a6f10117031da65c36fa (diff)
downloadgtk+-9ccee8a3fceef43c61094c3bda953cb5b0db4f90.tar.gz
use a scrolled window in the clist example. Minor tutorial fixes.
Sat Apr 10 13:52:54 BST 1999 Tony Gale <gale@gtk.org> * docs/gtk_tut.sgml, examples/clist.c: use a scrolled window in the clist example. Minor tutorial fixes.
Diffstat (limited to 'examples/clist')
-rw-r--r--examples/clist/clist.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/examples/clist/clist.c b/examples/clist/clist.c
index 41a5dcaa53..9bb4d22a03 100644
--- a/examples/clist/clist.c
+++ b/examples/clist/clist.c
@@ -83,7 +83,7 @@ int main( int argc,
{
GtkWidget *window;
GtkWidget *vbox, *hbox;
- GtkWidget *clist;
+ GtkWidget *scrolled_window, *clist;
GtkWidget *button_add, *button_clear, *button_hide_show;
gchar *titles[2] = { "Ingredients", "Amount" };
@@ -103,7 +103,15 @@ int main( int argc,
gtk_container_add(GTK_CONTAINER(window), vbox);
gtk_widget_show(vbox);
- /* Create the GtkCList. For this example we use 2 columns */
+ /* Create a scrolled window to pack the CList widget into */
+ scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+
+ gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
+ gtk_widget_show (scrolled_window);
+
+ /* Create the CList. For this example we use 2 columns */
clist = gtk_clist_new_with_titles( 2, titles);
/* When a selection is made, we want to know about it. The callback
@@ -121,8 +129,8 @@ int main( int argc,
*/
gtk_clist_set_column_width (GTK_CLIST(clist), 0, 150);
- /* Add the GtkCList widget to the vertical box and show it. */
- gtk_box_pack_start(GTK_BOX(vbox), clist, TRUE, TRUE, 0);
+ /* Add the CList widget to the vertical box and show it. */
+ gtk_container_add(GTK_CONTAINER(scrolled_window), clist);
gtk_widget_show(clist);
/* Create the buttons and add them to the window. See the button