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

Re: autoresize of ctree?



On Sun, 06 Feb 2000 14:27:05 +0100, lists@nuts.netplace.de wrote:
> got here a little problem with my directory-browser (implemented as ctree)
> (Gtk 1.2.6)
> 
> Works fine, but when the user descends so far in the directory hierachy,
> that the tree is getting wider as the screen, there wont be a
> horizontal scrollbar displayed.
> 
> I tried several things and the only a call like:
> 
>         gtk_clist_set_column_auto_resize(GTK_CLIST(ctree),0,TRUE); 
>     (this seems to be missing for ctrees)
> 
> has the desired effect - but this produces a lot of 
> 
> Gdk-CRITICAL **: file gdkfont.c: line 304 (gdk_string_width): assertion `string
> != NULL' failed.
> 
> errors...
> 
> Can anybody give me a pointer how to put a ctree in a scrolled window
> to make the scrollbars works as expected?
> 
> Here is the code snipplet:
> 
>         scrolled_win = gtk_scrolled_window_new (NULL, NULL);
>         gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
>                 GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
>         gtk_box_pack_start(GTK_BOX(vbox),scrolled_win,TRUE,TRUE,0);
>         gtk_widget_realize(scrolled_win);
>         gtk_widget_show(scrolled_win);
> 
>         ctree = create_directory_ctree("/",NULL,toplevel,entry1, 1);
>     /* gtk_clist_set_column_auto_resize(GTK_CLIST(ctree),0,TRUE); */
> 
>         gtk_container_add (GTK_CONTAINER (scrolled_win), GTK_WIDGET (ctree));
>         gtk_widget_show( GTK_WIDGET (ctree));
> 
> Tried also instead of gtk_container_add:
> 
>        
> gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_win),
>                 GTK_WIDGET (ctree));
> 
> 
> thanks for any hints..

Not directly a solution to your problem, but...

You can make a directory browser by using a standard file selection dialog
with the file_list hidden:

  GtkWidget *dirbrowser;

  dirbrowser = gtk_file_selection_new("Directory browser");

  /* hide the files */
  gtk_widget_hide(GTK_FILE_SELECTION(dirbrowser)->file_list);

  /* connect signals */
  /* show widget */
  gtk_widget_show(dirbrowser);


Erik

-- 
Sometimes a cigar is just a cigar.
 -- Sigmund Freud





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