Re: Why "m_scrwindow" doesn't resize vertically ?



Hi guys,

To explain better my problem, I write for you a little example code...

---
#include <gtkmm.h>

class DialogTest
: public Gtk::Dialog
{
public:
	DialogTest();
	~DialogTest(){};

private:
	Gtk::Frame m_frame;

	Gtk::Label m_label;

	Gtk::ScrolledWindow m_scrwindow;
	Gtk::TextView m_textview;
	Gtk::Table m_table;

	Glib::RefPtr <Gtk::TextBuffer> m_textbuffer;
};

DialogTest::DialogTest()
: 	m_label ("This is a test label..."),
	m_table (2, 1, false)
{
	set_title ("Test Dialog");
	set_deletable (false);

	m_scrwindow.add (m_textview);
	m_scrwindow.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
	m_scrwindow.set_shadow_type (Gtk::SHADOW_ETCHED_IN);

	m_textbuffer = Gtk::TextBuffer::create();

	m_textview.set_buffer (m_textbuffer);
	m_textview.set_editable (true);

	m_table.attach (m_label, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK, 0, 0);
	m_table.attach (m_scrwindow, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND,
Gtk::FILL|Gtk::EXPAND, 0, 0);

	m_frame.set_shadow_type (Gtk::SHADOW_ETCHED_IN);
	m_frame.add (m_table);

	// Not compiles (for me...)
	// error: ‘get_content_area’ was not declared in this scope
	// get_content_area() -> pack_start (m_frame);

	get_vbox() -> add (m_frame);

	add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK);

	show_all();

	run ();
	
	hide();

	show_all();
}

int main (int argc, char *argv[])
{
	Gtk::Main test (argc, argv);

	DialogTest dialogtest;

	return 0;
}
---

When resizing the dialog, the scrolledwindow remains with the same
vertical size... and lefts available space blank....

The idea is to adjust the scrolledwindow space, resizing the dialog...

Glus


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