hi all, what's the preferred way to query the content of a Gnome::Canvas::RichText instance. i've experienced the following: Gnome::Canvas::RichText text(..); ... text->property_text(); returns the initial string, given in the constructor. however, if the text is changed from user input, this is not updated. text->get_buffer()->get_text(); returns the current string (the one that i want to have), but calls to get_buffer() turned out result in a highly unstable system: Gtk-CRITICAL **: gtk_text_buffer_get_iter_at_offset: assertion `GTK_IS_TEXT_BUFFER (buffer)' failed i've attached a hacked version of examples/canvas/canvas.cc to demonstrate the crash ... maybe someone knows, what's going on there ... thanks ... tim -- tim klingt org ICQ: 96771783 http://www.mokabar.tk A paranoid is a man who knows a little of what's going on. William S. Burroughs
// This example was started by Guillaume Laurent. // It has become a place to dump code that tests parts of the // gnomemm canvas code. Little thought has been given to the // actual on-screen output. #include <libgnomecanvasmm.h> class CanvasExample : public Gnome::Canvas::Canvas { public: CanvasExample(); virtual ~CanvasExample(); protected: Gnome::Canvas::Group m_canvasgroup; Gnome::Canvas::RichText *m_rtext; }; CanvasExample::CanvasExample() : m_canvasgroup(*(root()), 0, 0) { m_rtext = new Gnome::Canvas::RichText(m_canvasgroup, 10, 10, "Some other Text"); m_rtext->property_width() = 100.0; m_rtext->property_height() = 30.0; Glib::ustring label = m_rtext->get_buffer()->get_text(); std::cout << label << std::endl; } CanvasExample::~CanvasExample() { delete m_rtext; } //MainWin: class MainWin : public Gtk::Window { public: MainWin(const std::string& title); protected: //Member widgets: CanvasExample m_canvas; }; MainWin::MainWin(const std::string& title) { set_title (title); add(m_canvas); show_all(); } //main(): int main(int argc, char *argv[]) { Gnome::Canvas::init(); Gtk::Main app(argc, argv); MainWin mainwin("Gnome::Canvas Example"); app.run(mainwin); return 0; }
Attachment:
signature.asc
Description: This is a digitally signed message part