confused by CList



I'd like to make a clist which will definitely need a vertical
scrollbar.   I'm having great difficulty.  :(

1- The scrolled window acts as if the clist doesn't need scrollbars.
when I set policy by:

   gtk_scrolled_window_set_policy(MasterDirScrollWin,
      GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

Both scrollbars disappear (I was expecting just the horizontal scrollbar
to vanish).  The data is obviously there (I can see a little bit of the
next line poking its head from above the bottom of the viewport.

2- The columns aren't being set to a good size.  My data looks like:

   COLORMAP | /usr/local/share/games/doom/doom2.wad |  23144 | 123432
   VERTEXES | combine.wad                           |  1233  | 12

but instead, what I'm seeing is:

   COLO | /usr |  23 | 123
   VERT | comb |  12 | 12

Is the clist supposed to negotiate the column size from the largest
element or do I need to do this?


Here is the code.   Any code tips would be greatly appreciated!  I'm
brand spanking new to gtk programming.


Pete




 /* Master Dir */
 {
     MDirPtr dir;
     gchar *text[4] = { "Name", "File", "Size", "Start" };

     MasterDirFrame = gtk_frame_new("Master Directory Listing");
     MasterDirCList = gtk_clist_new_with_titles(4, text);

     /* Make The CList */

     for (dir=MasterDir; dir; dir=dir->next) {
        text[0] = dir->dir.name;
        text[1] = dir->wadfile->filename;
        snprintf(buf, BUFSIZE, "%ld", dir->dir.size);
        text[2] = buf;
        snprintf(buf, BUFSIZE, "%ld", dir->dir.start);
        text[3] = buf;
        gtk_clist_append(GTK_CLIST(MasterDirCList), text);
      }

      /* The Scrolled Window */
      MasterDirScrollWin = gtk_scrolled_window_new(NULL, NULL);
      gtk_scrolled_window_set_policy(MasterDirScrollWin,
            GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
      gtk_widget_set_usize(MasterDirScrollWin, 200, 400);
      gtk_scrolled_window_add_with_viewport(
            GTK_SCROLLED_WINDOW(MasterDirScrollWin), MasterDirCList);
      gtk_container_set_focus_vadjustment( GTK_CONTAINER(MasterDirCList),
         gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(MasterDirScrollWin)));


      /* pack the scrolled window in frame */
      gtk_container_add(GTK_CONTAINER(MasterDirFrame), MasterDirScrollWin); 
      /* pack the frame in the top level vbox */
      gtk_box_pack_start(GTK_BOX(InfoPage), MasterDirFrame, FALSE, FALSE, 0);
   }




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