Horizontal scrollbar with a grid in wx2.9 ? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Muetdhiver
Super wx Problem Solver
Super wx Problem Solver
Posts: 323
Joined: Sun Jun 08, 2008 11:59 am
Location: Bordeaux, France

Horizontal scrollbar with a grid in wx2.9 ?

Post by Muetdhiver »

Hi all,

again another issue related to wx2.9, that was working in wx2.8...

I've made a scrabble game, as you can see in the following picture, the grid is on left, and the info panel with a score grid is on the right.
Those panels are in sizers with a GROW attribute and the proportion are 10 for the game grid, 7 for the right panel.

In the previous verion of my software (running with wx2.8), that was working well, the game grid was displayed in big, with a proportion of 10/7 compared to the info panel to the right.
The score grid that is in the info panel was truncated, and a horizontal scrallbar appeared to be abled to move in order to see the whole grid.
That is want I want.

But now, I'm with wx2.9, and the score grid is always rendered in big, that is to say there is no horizontal scrollbar, and no way to reduce the grid size. All columns are always displayed.... Even if my panel has a grow attributes.
Image

How must I do to force the grid to be partially displayed with a horizontal scrollbar that let me scoll on the whole grid width ?

Thanks a lot.
OS: Ubuntu 11.10
Compiler: g++ 4.6.1 (Eclipse CDT Indigo)
wxWidgets: 2.9.3
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Horizontal scrollbar with a grid in wx2.9 ?

Post by doublemax »

I don't think this has anything to do with wxGrid, there is a change in sizer behavior in wx2.9.x

From docs/changes.txt:

Code: Select all

- Sizers distribute only the extra space between the stretchable items
  according to their proportions and not all available space. We believe the
  new behaviour corresponds better to user expectations but if you did rely
  on the old behaviour you will have to update your code to set the minimal
  sizes of the sizer items to be in the same proportion as the items
  proportions to return to the old behaviour.
I personally didn't like this change, as it definitely does not match my "user expectation" ;)
Use the source, Luke!
Muetdhiver
Super wx Problem Solver
Super wx Problem Solver
Posts: 323
Joined: Sun Jun 08, 2008 11:59 am
Location: Bordeaux, France

Re: Horizontal scrollbar with a grid in wx2.9 ?

Post by Muetdhiver »

Hi, thanks !

This means that I have to set the size of the wxGrid explicitly to the width I want ?
I already tried MyGrid::SetVirtualSize( 200, 200) but nothing happens, the grid stay in big.
I also tried to SetVirtualSize to the parent container of the grid ==> the Panel "Topping" that is in the notebook. Nothing changed too.

Can you suggest me something ?
OS: Ubuntu 11.10
Compiler: g++ 4.6.1 (Eclipse CDT Indigo)
wxWidgets: 2.9.3
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Horizontal scrollbar with a grid in wx2.9 ?

Post by doublemax »

I think you need SetMinSize() (or pass a size in the control's constructor which implicitly does the same).
Use the source, Luke!
Muetdhiver
Super wx Problem Solver
Super wx Problem Solver
Posts: 323
Joined: Sun Jun 08, 2008 11:59 am
Location: Bordeaux, France

Re: Horizontal scrollbar with a grid in wx2.9 ?

Post by Muetdhiver »

Hi !

Thanks, doing this (SetMinSize) works well.
That is just sad that I have to set the wxGrid size myself and that it is not computed automatically.
Doublemax, you're right, this change in wx2.9 is not really good !!

Again thanks for the help.

Bye.
OS: Ubuntu 11.10
Compiler: g++ 4.6.1 (Eclipse CDT Indigo)
wxWidgets: 2.9.3
Post Reply