Notebook widget with unequal page sizes in Scrolled_Window

For an application program ( I
have a notebook widget included in a scrolled_window. Problem is, that
the pages of the notebook have different sizes, and small pages which
fits into the visible area yet have a visible scrollbar. Following Ruby
code shows my problem (if necessary, I can translate that code to plain
C, but I think that would make no difference.)

require 'gtk3'
window =
window.signal_connect('delete_event') { Gtk.main_quit }
scrolled_window =
nb =
label1 ="1st Pg")
label2 ="2st Pg")
note1  ="Short label")
note2  ="Label with very, very long name")
nb.append_page(note1, label1)
nb.append_page(note2, label2)

For page 1 it shows this picture

with the undesired scrollbar at the bottom.

It seem that the size of the notebook widget is determined not by the
currently visible page, but by the largest (invisible) one. So
scrollbars appear whenever the visible area is smaller than the largest
notebook page, even when currently a much smaller page/widget is

One solution may be: Do not put the whole notebook widget into a
scrolled_window, but put each page of the notebook into its own
scrolled_window. Will that work, and is that the the recommended way?
(It will need more code and more widgets total...)

Or is there a better way?

(For label widgets, I may consider "ellipsize" property, which cuts
names if they are too long for the visible area, but I am looking for a
general best approach with works fine with all kind of widgets in pages
of notebooks)

Best regards,

Stefan Salewski

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