vadjustment->page_size is zero



I'm using GTK2.0 on Red Hat 9. I've looked in the archives, but can't see anything that might explain what's happening.

My application uses a canvas held in a scrolled window and the user can split the display horizontally (ie new pane below the old one). On initial display, the vadjustment->page_size has a sensible value, reflecting the number of pixels the window is high.

After splitting, the page_size is zero.

The processing runs through the same function for each pass, so I can't see why the adjustment is zero the second time.

Hope someone can explain why this happens.

Thanks
Rob
Sample code:

  spane->parentWindow = window;
  spane->frame        = gtk_frame_new(NULL);
  spane->swindow      = gtk_scrolled_window_new (NULL, NULL);

  /* draw the canvas */
  w = foo_canvas_new();
  spane->canvas = FOO_CANVAS(w);
  foo_canvas_set_scroll_region(spane->canvas, 0.0, 0.0, width, height);

  /* add the canvas to the scrolled window */
  gtk_container_add(GTK_CONTAINER(spane->swindow),w);

  GTK_LAYOUT (w)->vadjustment->step_increment = 10;
  GTK_LAYOUT (w)->hadjustment->step_increment = 10;

  /* add the scrolled window to the frame */
  gtk_container_add(GTK_CONTAINER(spane->frame),spane->swindow);

  /* First time through, we add the frame to the main vbox.
   * Subsequently it goes in the lower half of the current pane. */
  if (window->focuspane)
gtk_paned_pack2(GTK_PANED(window->focuspane->pane), spane->frame, TRUE, TRUE);
  else
    gtk_box_pack_start(GTK_BOX(window->vbox), spane->frame, TRUE, TRUE, 0);

  gtk_widget_show_all (window->window);

  {
GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(spane->swindow));
    printf("page size %.0f\n", adj->page_size);
    adj = gtk_layout_get_vadjustment(GTK_LAYOUT(spane->canvas));
    printf("page size %.0f\n", adj->page_size);
  }

Sample output:

rnc deskpro223:[rnc/play] ./split
page size 482
page size 482
page size 0
page size 0
rnc deskpro223:[rnc/play]





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