Notebook widget with unequal page sizes in Scrolled_Window

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

 



For an application program (http://www.ssalewski.de/PetEd.html.en) 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 = Gtk::Window.new
window.signal_connect('delete_event') { Gtk.main_quit }
scrolled_window = Gtk::ScrolledWindow.new
nb = Gtk::Notebook.new
label1 = Gtk::Label.new("1st Pg")
label2 = Gtk::Label.new("2st Pg")
note1  = Gtk::Label.new("Short label")
note2  = Gtk::Label.new("Label with very, very long name")
nb.append_page(note1, label1)
nb.append_page(note2, label2)
scrolled_window.add(nb)
window.add(scrolled_window)
window.show_all
Gtk.main

For page 1 it shows this picture

http://www.ssalewski.de/tmp/nbw.png

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
displayed.

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


_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list




[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux