Re: Scrollbars and multiple viewports.



Hi again,

I tried to follow your recipe but I get a runtime error from gdk:

Gdk-CRITICAL **: file gdkwindow.c: line 1390
(gdk_window_get_size): assertion `window != NULL' failed.

As soon as two or more scrolled windows use the same adjustment, I get
this error one time per window using the adjustment.
This is what i do, I hope all relevant code is in. Basically:
create a gtk_table and two scrolled windows and something to pack into
them. One of the scrolled windows with the adjustments of the other.
Pack the things together, and show it. The errors are the same if I
set the adjustments after creation or keep the scrollbars on on both of
the windows. Any help are welcome

Thanks,
David.

Extract of the code :


  table = gtk_table_new(3,3,FALSE);

  l1 = gtk_button_new_with_label ("Hello World,Hello 1"); 
  l2 = gtk_button_new_with_label ("Hello World2"); 

  swPattern = gtk_scrolled_window_new(NULL,NULL);
  hadj = gtk_scrolled_window_get_hadjustment(
                         GTK_SCROLLED_WINDOW(swPattern));
  vadj = gtk_scrolled_window_get_vadjustment(
                         GTK_SCROLLED_WINDOW(swPattern));

  swPedals = gtk_scrolled_window_new(hadj,vadj);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swPedals),
				 GTK_POLICY_NEVER,GTK_POLICY_NEVER);


  gtk_scrolled_window_add_with_viewport(
                                 GTK_SCROLLED_WINDOW(swPattern),l1);
  gtk_scrolled_window_add_with_viewport(
                                 GTK_SCROLLED_WINDOW(swPedals),l2);

  gtk_table_attach(GTK_TABLE(table),swPattern,
		   0,1,0,1,
		   GTK_FILL,GTK_FILL,
		   1,1);
  gtk_table_attach(GTK_TABLE(table),swPedals,
		   1,2,0,1,
		   GTK_FILL,GTK_FILL,
		   1,1);

  gtk_widget_show_all(toplevel);


On Mon, 1 Oct 2001, Paul Davis wrote:

> >It seems to be a problem to connect to different viewports to the same
> >scrollbars adjustment. It seems that the adjustment just wants one
> >viewport each. Does anyone know how to construct something like this, or
> >just how to connect two viewports to the same scrollbar.
> >
> >I'm new to this, please keep it simple if possible.
> 
> I am doing this in my current project. Its pretty easy. Use 2 scrolled
> windows (i.e. not just viewports). Set the adjustment of one to the
> adjustment of the other. Turn off scrollbars
> (gtk_scrolled_window_set_policy) for the one of them. Turn on
> scrollbars for the other. Presto.
> 
> --p
> 




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