spin have some issues.
« on: 10 January 2018, 16:37:03 »
Hello Texus

I tried "spinbutton" but setBackgroundColor,  setBackgroundColorNormal,  setBackgroundColorHover not working nor from txt file, neither from code.

Also, what is the difference between setBackgroundColor and setBackgroundColorNormal?

Suggestions: It would be great if a step value exist. Also, a text shown with the current value in between buttons as optional would be great!

thank you.


*

texus

  • *****
  • 1248
    • View Profile
    • Texus's Blog
Re: spin have some issues.
« Reply #1 on: 10 January 2018, 19:02:14 »
I tried the following and it worked:
auto spinButton = tgui::SpinButton::create();
spinButton->getRenderer()->setBackgroundColor(sf::Color::Blue);
gui.add(spinButton);

Based on the note in the documentation, is there any chance the renderer was already using images before you called setBackgroundColor? In that case you have to remove the images as well:
spinButton->getRenderer()->setArrowUpTexture({});
spinButton->getRenderer()->setArrowDownTexture({});

The setBackgroundColor function existed so that you didn't have to call both setBackgroundColorNormal and setBackgroundColorHover if you don't want the widget to have a separate color on hover.


Quote
Suggestions: It would be great if a step value exist. Also, a text shown with the current value in between buttons as optional would be great!
I'll implement the step value somewhere this week in 0.8-dev (as no more features are added to 0.7). Having a text in between is a nice idea, but not something that should be expected anywhere soon. I'll add it to my todo list though.

Re: spin have some issues.
« Reply #2 on: 10 January 2018, 20:36:38 »
Forget to mention that i 'm still using 0.7 version.
Tried your suggestion but still not working. Maybe is because i have long distance between arrow keys.
The image show my spin button (upper draw). The down spin button is the one setting null the textures.

*

texus

  • *****
  • 1248
    • View Profile
    • Texus's Blog
Re: spin have some issues.
« Reply #3 on: 10 January 2018, 22:25:53 »
I don't see why it wouldn't be working. In the top image the colors you set (other than the border color) are ignored because there are textures, but the bottom image is clearly rendered using colors so it should work. Are you certain you called setBackgroundColor on the bottom spin button? Could you show the code that you use to create the SpinButton?

Re: spin have some issues.
« Reply #4 on: 10 January 2018, 22:38:24 »
Yes the background color is working but not for the space between buttons. The background color should fill the space (SpaceBetweenArrows) with the defined color. In my case is grey.
If, still you can not replicate the problem, let me know. I'll make a test case and post.

In photo i am using
pButton->getRenderer()->setBackgroundColor(sf::Color(193, 204, 199));
without textures

« Last Edit: 10 January 2018, 22:43:15 by billarhos »

*

texus

  • *****
  • 1248
    • View Profile
    • Texus's Blog
Re: spin have some issues.
« Reply #5 on: 11 January 2018, 07:49:47 »
The space between the arrows uses the border color. The space actually wasn't meant to be used like this. The problem was that the borders only defined an area around the arrows, it couldn't define what was inbetween (as you might want to make this slightly less or slightly more thick than the borders that are around the arrows). So I added a SpaceBetweenArrows option to set how thick the border should be between the arrows.

Re: spin have some issues.
« Reply #6 on: 11 January 2018, 08:18:27 »
Ok Texus. Now it is clear to me. Cheers