A way to set minimum thumb size.

Started by Qvark, 06 August 2018, 00:55:38

Qvark

Hi,

I would love to see a way to set a minimum size for the "thumb/draggable area" on a scrollbar.
As it is I am loading a lot of data into a listbox causing the draggable area to shrink until it vanishes after awhile.
It would be great with a function like setThumbMinimumSize or something like this.

texus

That's something that has been on my todo list for a while, so I guess I should really give this another look. It's not easy to add because it changes all the internal calculations about where the thumb is located, which is the reason why is hasn't been done yet.

But I'm not sure if it is necessary to have a setThumbMinimumSize function, I would just go with a max thumb size that equals either 1x, 1.5x or 2x the width of the scrollbar (I'm not sure what is best, I should look up again which was most commonly used, I think it was 1x).

Qvark

Sounds great either way, it would be appreciated for sure.

texus

#3
I've implemented it such that the thumb will never be smaller than the scrollbar width.
You can download the latest version from github.

Qvark

Wow, that was really fast!
Thank you. I'll be trying it out very soon.

Qvark

#5
Loved your min size thumb addition.

I have another thing that puzzles me now.  :D

I don't seem to get any backspace events in my EditBox widget. Is this by design? Del key works though, although that is not as nice since I then have to move an "invisible marker" to in-front of where I want to delete.
I should add that so-far I am not using any themes but the default one.
Should add that I am compiling on Windows currently.

texus

Backspace key should work fine. Try adding something like this in front of "gui.handleEvent(event)":
Code (cpp) Select
if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::BackSpace))
{
// Check if you pass here or not
}


If the code never reaches the body of that if statement then it isn't a problem inside TGUI.

Could you elaborate on what you mean with "invisible marker"? The cursor should be blinking when the edit box is focused and should become visible on any operation (e.g. when you press an arrow key several times in a row, it will remain visible during this time).

Qvark

Hey, yeah it works was my bad, just had to rearrange some input logic.
Staying up too late at night =D