wxGrid with NO horizontal scrollbar *EVER*

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
cpp
I live to help wx-kind
I live to help wx-kind
Posts: 195
Joined: Wed Sep 28, 2005 9:42 pm

wxGrid with NO horizontal scrollbar *EVER*

Post by cpp » Thu Mar 02, 2006 10:32 pm

Hi! Im using a wxGrid with 2 columns to work like a simple "property editor", the deal is i do not want it to show a horizontal scroll bar not ever, not even if the panel is resized to a smaller size, ibe tried 1001 things, like:
* not passing wxHSCROLL to its constructor
* calling SetScrollRate(0, 10)
* 999 other things i cant remember right now :D
Nothing seems to work. The damn thing still shows the horiz scrollbar if it gets smaller than the size of all its columns.

so the question is, how do i force wxGrid to never show a horizontal scrollbar?

Thanks!
Hier Kommt die Sonne...

phlox81
wxWorld Domination!
wxWorld Domination!
Posts: 1387
Joined: Thu Aug 18, 2005 7:49 pm
Location: Germany
Contact:

Post by phlox81 » Fri Mar 03, 2006 7:24 am

wxScrollWindow::EnableScrolling(bool,bool)

wxGrid is derived from wxScrolledWindow.

phlox

cpp
I live to help wx-kind
I live to help wx-kind
Posts: 195
Joined: Wed Sep 28, 2005 9:42 pm

Post by cpp » Fri Mar 03, 2006 9:41 pm

Thanks for your answer phlox.
Ibe tried that, but it doesnt work, horizontal scrollbar still there.
Hier Kommt die Sonne...

Ksmith22
I live to help wx-kind
I live to help wx-kind
Posts: 199
Joined: Mon Nov 21, 2005 4:34 pm

Post by Ksmith22 » Fri Mar 03, 2006 9:50 pm

Try:

Code: Select all

wxGrid::SetMargins(-20, -20);
I think that will work, since it lowers the margin enough that the scrollbar doesn't appear (you are basically fooling it into thinking it doesn't need one). It worked for me but your situation might be different. You may have to mess with the numbers some more to get it right too.

In any case, I am almost positive there is no other way to do it. Don't even know why it's derived from wxScrolledWindow because I don't think any of those functions even work on it. wxGrid has so many problems with it already. I've seen some discussion in the dev mailing lists about replacing it with something better (or fixing it) so hopefully that will happen in the near future.

cpp
I live to help wx-kind
I live to help wx-kind
Posts: 195
Joined: Wed Sep 28, 2005 9:42 pm

Post by cpp » Fri Mar 03, 2006 10:02 pm

Thanks Ksmith.
But unfortunately, no luck, Scrollbars remain. I tried messing with the numbers, but the only visual result is that the 2nd column doesnt get fully shown, even if i move the scrollbar to the edge. Im beginning to think that the only solution, is the quite complex approach to:
1.- initially set the size of the grids column so that all combined are less that the width of the grid itself
2.- catch OnSize events on the grid
Hier Kommt die Sonne...

kucalaba
In need of some credit
In need of some credit
Posts: 7
Joined: Sat Feb 17, 2007 1:26 am

Post by kucalaba » Fri Mar 16, 2007 8:18 pm

Try this, it worked for me...

grid->SetScrollbars(0, 0, 0, 0);

Luke

Post Reply