Re: Strange Gtk::TreeStore behaviour



Thanks Marco..

That works.. But still I find the behavior strange. After all, if in
signal_row_expanded I don't delete the children but simply add some,
those do get reflected in the UI.

Regards
Ram

On 9/17/05, Marco Scholten <mscholtn xs4all nl> wrote:
> > Hi,
> >
> > I am encountering an unexpected behavior in Gtk::TreeStore. I am
> > connecting a handler to signal_row_expanded to refresh the row
> > contents. To do this, I am simply removing the old contents and adding
> > children again. But when I expand the row in GUI, it doesn't get
> > expanded at all to show the children!
> 
> What's happening here is that the row is expanded before on_row_expanded is
> executed, you then remove the expanded children and add new ones, those new
> children don't get expanded again.
> 
> You can observe this behaviour by changing on_row_expanded to:
> 
> void ExampleWindow::on_row_expanded(const Gtk::TreeModel::iterator & iter,
> const Gtk::TreeModel::Path & path)
> {
>    std::cout << "on_row_expanded" << std::endl;
>    while(Gtk::Main::events_pending()) Gtk::Main::iteration();
>    char a;
>    std::cin >> a;
>    std::cout << "removing children" << std::endl;
>    remove_children(*iter);
>    std::cout << "adding children" << std::endl;
>    add_children(*iter);
> }
> 
> Fix it by connecting to signal_test_expand_row (this signal is emitted
> before the row is expanded) and then return false from your signal handler.
> 
> --
> Marco
> 
>



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