spin have some issues.

Started by billarhos, 10 January 2018, 16:37:03

billarhos

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

I tried the following and it worked:
Code (cpp) Select
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:
Code (cpp) Select
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.


QuoteSuggestions: 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.

billarhos

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

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?

billarhos

#4
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


texus

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.

billarhos

Ok Texus. Now it is clear to me. Cheers