Reputation: 141
I'm trying to add and delete rows to a GridBagSizer dynamically. Each row of the sizer has a collection of widgets with the rightmost being a 'delete' button which removes the row it's in when pressed. Another button outside the sizer adds a new bottom row of widgets to the sizer when pressed.
I have a simple example app that works, but it's rather baroque and I'm hoping there's a simpler way.
The working example detaches and destroys all widgets in the row being deleted, but this doesn't remove the blank row where the widgets used to be, even after sizer.Layout(). What I have done to get around this is detach all widgets in rows below the removed row and move them one row up.
It works, but is there a better way?
Ross
Upvotes: 1
Views: 455
Reputation: 21
This is a tip really. Use
sizer.SetEmptyCellSize((0,0))
and your empty row will not take any space.
Upvotes: 2