A way to set minimum thumb size.
« on: 06 August 2018, 00:55:38 »
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

  • *****
  • 1248
    • View Profile
    • Texus's Blog
Re: A way to set minimum thumb size.
« Reply #1 on: 06 August 2018, 08:15:17 »
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).

Re: A way to set minimum thumb size.
« Reply #2 on: 06 August 2018, 13:28:39 »
Sounds great either way, it would be appreciated for sure.

*

texus

  • *****
  • 1248
    • View Profile
    • Texus's Blog
Re: A way to set minimum thumb size.
« Reply #3 on: 06 August 2018, 22:38:20 »
I've implemented it such that the thumb will never be smaller than the scrollbar width.
You can download the latest version from github.
« Last Edit: 06 August 2018, 22:47:35 by texus »

Re: A way to set minimum thumb size.
« Reply #4 on: 07 August 2018, 00:40:07 »
Wow, that was really fast!
Thank you. I'll be trying it out very soon.

Re: A way to set minimum thumb size.
« Reply #5 on: 11 August 2018, 03:58:24 »
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.
« Last Edit: 11 August 2018, 04:05:15 by Qvark »

*

texus

  • *****
  • 1248
    • View Profile
    • Texus's Blog
Re: A way to set minimum thumb size.
« Reply #6 on: 11 August 2018, 10:20:40 »
Backspace key should work fine. Try adding something like this in front of "gui.handleEvent(event)":
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).

Re: A way to set minimum thumb size.
« Reply #7 on: 11 August 2018, 22:52:41 »
Hey, yeah it works was my bad, just had to rearrange some input logic.
Staying up too late at night =D