Carl Ding wrote:
> The problem is when I delete a row, I use Fl::delete_widget to remove all
> the embedded widgets in that row. The program crashed when doing
> fl_draw(). Is there anything else should be done to remove a row from
> Fl_Table?
>
> Thanks!
This is what I did:
void Fl_Table_Group::remove(int r)
{
if(r < 0 || r >= rows())
return;
int idx = r*cols();
// Remove all the widgets from row r
for(int c = 0; c < cols(); c++)
{
Fl_Widget *w = child(idx);
Fl_Table_Row::remove(*w);
Fl::delete_widget(w);
}
// Update row count
rows(rows()-1);
}
If you want to check out the Fl_Table_Group you can here:
http://www.mediafire.com/?sharekey=4b1e5c5790c805317172638919447f8bdc8e115f9f4243ba
You will find a .tar.gz and a .zip. They both contain the same code.
Here are some details of the implementation:
* The name, Fl_Table_Group, is suppose to imply that this widget is like a
Fl_Group (much in the same way as Fl_Tile). The widgets that are created
between the begin()/end() are laid out in a table fashion.
* void Fl_Table_Group::clear() Removes all the rows, but leaves the columns
untouched.
* Fl_Widget* Fl_Table_Group::cell(int r, int c) Retrieves the widget/cell at
row r and column c
* void Fl_Table_Group::end() Automagically determines the number of rows
that have been added. Only full rows, not partial, are determined. Also,
the number columns must be set.
* Initially, the width of the columns are such that the entire table width
is used.
--
Alvin
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk