Removing Widgets From Gtk::Table



I'm writing a program that will dynamically resize a table, but I'm
having some trouble understanding how the interface is supposed to
work. I'm using Gtkmm 2.6.2

I can add new widgets to the table simple enough, it's no different
than packing them in in the first place, the trouble is removing them.

Here is a snippet of code as it stands:

Table_Helpers::TableList data = m_table.children();
int new_value = m_guests.get_value_as_int();
int nRow  = m_table.property_n_rows();
int nCol  = m_table.property_n_columns();

// Remove entries from the end
while( data.size() > new_value )
{
    Table_Helpers::TableList::iterator iter = data.end();
    data.erase(--iter);

    // Remove last row if necessary
    if( (data.size() % 2) == 0 )
       m_table.resize( --nRow, nCol );
}

There's not a lot of documentation regarding how to use erase and
remove, so I'm not sure if I'm doing this completely wrong, but that's
my best guess.

That particular snippet causes this error when it reaches the call to erase():
(planner:19875): Gtk-CRITICAL **: gtk_container_remove: assertion
`GTK_IS_WIDGET (widget)' failed

There was a post on this list back on April 30, 2004 by someone having
the same error, but I didn't really understand the answer (plus, they
said it wouldn't occur after version 2.2).

If it makes any difference, the widgets are Gtk::Entry and are created
with manage() before packing them.

Any help would be greatly appreciated.


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