wxGrid extra white space with scrollbars

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.
AnatolShiro
In need of some credit
In need of some credit
Posts: 5
Joined: Tue Oct 10, 2017 10:49 am

wxGrid extra white space with scrollbars

Postby AnatolShiro » Tue Oct 10, 2017 11:10 am

Hello!
I have some problems with extra white spaces from bottom and from right in wxGrid when scrollbars are activated. I want to remove them.
As I understand those white spaces are coming from wxScrolled, but I can't find place where they added :?
Image
Can you help me please?

AnatolShiro
In need of some credit
In need of some credit
Posts: 5
Joined: Tue Oct 10, 2017 10:49 am

Re: wxGrid extra white space with scrollbars

Postby AnatolShiro » Wed Oct 11, 2017 5:49 am

Here is the picture of white spaces
Attachments
grid.png
grid.png (5.59 KiB) Viewed 164 times

catalin
Moderator
Moderator
Posts: 1387
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: wxGrid extra white space with scrollbars

Postby catalin » Wed Oct 11, 2017 7:44 am

IIRC the client surface of the scrolled window is a multiple of the page size, see SetScrollPageSize().
You can probably set the page size to be equal to the height of a row and width of a column respectively. Actually horizontally you can probably set the page size to a low value (i.e. 1, 2) and see how it affects your scrolling. It might not be too annoying.

AnatolShiro
In need of some credit
In need of some credit
Posts: 5
Joined: Tue Oct 10, 2017 10:49 am

Re: wxGrid extra white space with scrollbars

Postby AnatolShiro » Sun Oct 15, 2017 6:44 am

catalin wrote:IIRC the client surface of the scrolled window is a multiple of the page size, see SetScrollPageSize().
You can probably set the page size to be equal to the height of a row and width of a column respectively. Actually horizontally you can probably set the page size to a low value (i.e. 1, 2) and see how it affects your scrolling. It might not be too annoying.



Code: Select all

Grid1->SetScrollPageSize(1,1)
doesn't have any effect. I marked on the images what I want to remove. On first image is what I want to receive.
Attachments
grid_without_spaces.png
grid_without_spaces.png (5.59 KiB) Viewed 97 times
grid_marked.png
grid_marked.png (5.63 KiB) Viewed 97 times

catalin
Moderator
Moderator
Posts: 1387
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: wxGrid extra white space with scrollbars

Postby catalin » Sun Oct 15, 2017 8:32 am

AnatolShiro wrote:

Code: Select all

Grid1->SetScrollPageSize(1,1)
doesn't have any effect.

No wonder. I suggest you read again the docs of wxScrolled<T>::SetScrollPageSize(), especially for the first argument (hint: '1' is an invalid value for that).

Also after that call make sure you do not call other functions that may overwrite the page size, like wxScrolled<T>::SetScrollbars() or wxScrolled<T>::SetScrollRate().

AnatolShiro
In need of some credit
In need of some credit
Posts: 5
Joined: Tue Oct 10, 2017 10:49 am

Re: wxGrid extra white space with scrollbars

Postby AnatolShiro » Sun Oct 15, 2017 9:39 am

catalin wrote:I suggest you read again the docs of wxScrolled<T>::SetScrollPageSize(), especially for the first argument (hint: '1' is an invalid value for that).
Also after that call make sure you do not call other functions that may overwrite the page size, like wxScrolled<T>::SetScrollbars() or wxScrolled<T>::SetScrollRate().

Sorry, there is no explanation about this function in the online documentation (http://docs.wxwidgets.org/3.0/classwx_scrolled.html#aa160351f31a0080784a00023947a06f6).
Can you give me a link?
Also, I tried this:

Code: Select all

Grid1->SetScrollPageSize(wxHORIZONTAL,1);
Grid1->SetScrollPageSize(wxVERTICAL,1);

There is no any effect too.

AnatolShiro
In need of some credit
In need of some credit
Posts: 5
Joined: Tue Oct 10, 2017 10:49 am

Re: wxGrid extra white space with scrollbars

Postby AnatolShiro » Sun Oct 15, 2017 11:18 am

I found solutuion:

Code: Select all

Grid1->SetScrollRate(1,1);

This removes white spaces in the wxGrid
:D


Return to “C++ Development”

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 12 guests