Re: Scrolled window resizing question.
- From: Paul Davis <pjdavis engineering uiowa edu>
- To: Bartek Kostrzewa <bartek runbox com>
- Cc: gtkmm-list gnome org
- Subject: Re: Scrolled window resizing question.
- Date: Sat, 08 Oct 2005 14:59:21 -0500
Bartek Kostrzewa wrote:
pjdavis engineering uiowa edu wrote:
Does anyone know how to make a scrolled window stop expanding once the need for
a scrollbar is gone? I've been playing around with some different things but I
can't figure this one out.
The goal is to have a scrolled window that will expand while it still needs a
scrollbar, and then once the scroll bar dissappears, the widget stops expanding
with further expansion of the containing widget.
Thanks,
Paul Davis
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
from scrolledwindow.h:
void set_policy(PolicyType hscrollbar_policy, PolicyType
vscrollbar_policy);
from enums.h:
enum PolicyType
{
POLICY_ALWAYS,
POLICY_AUTOMATIC,
POLICY_NEVER
};
hence:
MyScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC);
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
Silly goose.
I understand the concept of setting the scrollbar policy.
The idea is that *using* the automatic scroll bar policy, when the
scroll bar dissappears, the scrolled window stops expanding. ( That
means change size )
I wrote a short little test to show what I mean.
compile with:
g++ `pkg-config gtkmm-2.4 --cflags --libs` scrolltest.cc -o scrolltest
////// ScrollTest.cc
#include <gtkmm.h>
#include <sstream>
#include <string>
class ScrollTest : public Gtk::Window
{
public:
ScrollTest()
{
set_title( "Scroll Test" ) ;
Gtk::VBox* scrolled_vbox = Gtk::manage( new Gtk::VBox() ) ;
scrolled_vbox->set_homogeneous( true ) ;
scrolled_vbox->set_border_width( 10 ) ;
scrolled_vbox->show() ;
Gtk::Label* label ;
for( int i = 0 ; i < 10 ; i++ )
{
std::stringstream ss ;
ss << "Label: " << ( i + 1 ) ;
label = Gtk::manage( new Gtk::Label( ss.str() ) ) ;
label->show() ;
scrolled_vbox->pack_start( *label, Gtk::PACK_SHRINK,
0 ) ;
}
Gtk::ScrolledWindow* scrolled_window = Gtk::manage( new
Gtk::ScrolledWindow() ) ;
scrolled_window->set_policy( Gtk::POLICY_NEVER,
Gtk::POLICY_AUTOMATIC ) ;
scrolled_window->show() ;
scrolled_window->add( *scrolled_vbox ) ;
Gtk::VBox* main_vbox = Gtk::manage( new Gtk::VBox() ) ;
main_vbox->show() ;
main_vbox->pack_start( *scrolled_window,
Gtk::PACK_EXPAND_WIDGET, 0 ) ;
label = Gtk::manage( new Gtk::Label( "Spacer" ) ) ;
label->show() ;
main_vbox->pack_start( *label, Gtk::PACK_EXPAND_WIDGET,
0 ) ;
add( *main_vbox ) ;
}
~ScrollTest() {}
} ;
int
main( int argc, char* argv[] )
{
Gtk::Main m( argc, argv ) ;
ScrollTest test ;
m.run( test ) ;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]