Opened 13 years ago

Closed 10 years ago

#2603 closed defect (fixed)

wxFlexGridSizer AddGrowableRow/Col problem

Reported by: finell Owned by:
Priority: normal Milestone:
Component: GUI-all Version: stable-latest
Keywords: wxFlexGridSizer Cc: finell, wojdyr
Blocked By: Blocking:
Patch: yes


I just noticed a slight problem with the growable
handling of the FlexGridSizer. If I'm calling the
AddGrowableRow/Col twice for the same row/col, the
proportion between two items is no longer the same when
resizing the window, ie. the item having the growable
set twice will grow larger than the other one.

Here's an example code that you could paste into the
sizers test code in the wxPython demo.

def makeGrid3(win):

gs = wx.FlexGridSizer(2,1)
gs.AddMany([(SampleWindow(win,'one'),0, wx.EXPAND),

(SampleWindow(win, 'two'), 0, wx.EXPAND)

# the extra call will make the first row grow

larger than

# the second row
return gs

Now running the "Flexible Grid" test case will show you
what I mean.

I know, that not calling AddGrowableRow/Col multiple
times will of course "fix" this problem. But I feel
that this should probably be taken care of in a lower

Oh, this is with wxPython- on Linux, and I've
also seen the same behaviour with on MSWin.

Attachments (2)

flexgridsizer.diff download (698 bytes) - added by wojdyr 10 years ago.
flexgridsizer2.diff download (2.0 KB) - added by wojdyr 10 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 10 years ago by wojdyr

  • Component set to GUI-all
  • Keywords wxFlexGridSizer added

comment:2 Changed 10 years ago by wojdyr

  • Patch set
  • Status changed from new to confirmed
  • Version set to 2.9-svn

the fix is attached

Changed 10 years ago by wojdyr

comment:3 Changed 10 years ago by vadz

  • Status changed from confirmed to infoneeded_new

Isn't calling AddGrowableRow() twice an indication of an error in the user code? I don't see any valid reason to do it and you can always call RemoveGrowableRow() first if you really need it. Maybe we need IsRowGrowable() but I'd be in favour of asserting if the same row is added twice as growable instead of silently doing nothing.

What do you think?

P.S. In any case, the documentation should mention what happens in this case.

comment:4 Changed 10 years ago by wojdyr

  • Cc wojdyr added

I don't have any preference here, so I'll change the patch as you suggested

comment:5 Changed 10 years ago by wojdyr

  • Status changed from infoneeded_new to new

new patch added

Changed 10 years ago by wojdyr

comment:6 Changed 10 years ago by vadz

  • Resolution set to fixed
  • Status changed from new to closed

Thanks, committed as r54607.

Note: See TracTickets for help on using tickets.