Kitchen Sink

Started by billarhos, 10 June 2019, 15:00:11

billarhos

Would a kitchen sink example would be useful for future tgui users?

texus

I think it would definitely be useful.

billarhos

Ok, i 've already started.

billarhos

During adding "labels" in kitchen sink i was thinking how awesome would be if a "texture" feature exist! There isn't a "texture" for labels, correct?

texus

How would a texture of a label be displayed? Do you mean a BackgroundTexture property as alternative to the BackgroundColor?

billarhos

#5
Yes exactly, a background texture instead of background color.


Labels tab finished

billarhos


texus

I've added a TextureBackground property to the label renderer.

I really like how it looks, but I got some minor feedbacks on some parts.
- On the "Labels" tab it also says "Canvas", is that something you are still going to add there or am I missing something?
- Labels can do more than demonstrated. Maybe at the bottom you can have a label with a lot of text in it, so that it gets a vertical scrollbar. There is also the possibility for a Label to have word-wrap by setting a width without setting a maximum height (via setMaximumTextWidth), although showing the version with a scrollbar is probably more important to showcase.
- Maybe "Double click me" would be better than "Click me double"?
- The arrow buttons in the Buttons tab don't seem to have a separate hover and down states. They might look better if the entire rectangle become a little more white when hovered and only gets the black arrow when in down state.
- Maybe pressing the Button0 again should switch it back to the original state? After you clicked on them you can see what they did but it is too late to actually pay attention to it. It is arguable that it serves mostly so you can see how to do it in the code, but then you might as well not switch the text at all.
- The "Button theme2", "Button theme3" and "Button theme4" buttons are probably named that way because they are "themed" button number X, but when I saw the names I expected them to have a different theme, just like the labels. If the name was e.g. "Button 2 with theme" then it would be more clear that the number is about the button, not the theme.
- Maybe swap the location of the "Open keyboard" button and the radio buttons? It is probably just because I wasn't paying attention, but I was clicking around and suddenly I got a different keyboard as before and I didn't immediately realize that it was because of the radio buttons next to it.
- To me the "CappsOff" and "CappsOn" seem inverted. It works either way as it depends on how you interpret it: does it show the current state vs the state you are going to. I personally expected it to be the latter instead of the former.

Overall I still love how it looks and what it is becoming. Keep up the good work!

billarhos

QuoteI've added a TextureBackground property to the label renderer.
Great!

QuoteOn the "Labels" tab it also says "Canvas", is that something you are still going to add there or am I missing something?
The bottom line is painted via "tgui::Canvas"; On top i give a clue to user of what i demonstrate in each tab!
I agree with all other stuff you said but when i ll finish the code i ll make the png texture theme, so all will make sense.

I believe tomorrow i will finish the code.

billarhos


pClickableWidget = tgui::ClickableWidget::create();
pClickableWidget->setPosition(50, 620);
        pClickableWidget->setSize(250, 100);

  tgui::ToolTip::setTimeToDisplay(sf::milliseconds(1000));
tgui::ToolTip::setDistanceToMouse({ 4, 8 });

pLabelToolTip = tgui::Label::create("ClickableWidget is here!");
pLabelToolTip->setPosition(pClickableWidget->getPosition());
pClickableWidget->setToolTip(pLabelToolTip);



the above code show the tooltip all the time. Missing something?

texus

Are you calling something like "gui.add(pLabelToolTip)" somewhere by any chance?
pLabelToolTip->setPosition shouldn't be called like that. The position will be relative to the mouse.

billarhos

QuoteAre you calling something like "gui.add(pLabelToolTip)" somewhere by any chance?
YES, i remove it. Now never shows.
Commenting "pLabelToolTip->setPosition()" also didn't help.

Should i give tooltip widget position?

texus

If you added it to the widget with setTooltip then it should show up on the bottom right of your mouse cursor (4 pixels to the right and 8 pixels down in this case) if put the mouse on top of the widget and don't move it for more than a second. You shouldn't have to call pLabelToolTip->setPosition at all, unless you want to add an extra offset to the tooltip which other widgets don't have.

Is there nothing in front of the clickable widget?

billarhos

Ha, i thought that "setTimeToDisplay" has to do with how long the tooltip would shown. Sorry.! I stay still for 1000 mscs and it appeared.

I think i am down with the code. i 'll move forward to finish gui.png!

texus

Now that you mention it, it does sound like that. Maybe I should rename it to setTimeBeforeDisplay or setTimeBeforeShowing?