Kitchen Sink

  • 36 Replies
  • 420 Views

Re: Kitchen Sink
« Reply #16 on: 14 June 2019, 08:12:50 »
While making SpinButton i found that texturearrowuppressed, texturearrowdownpressed are missing. Is there a reason?


*

texus

  • *****
  • 1400
    • View Profile
    • Texus's Blog
Re: Kitchen Sink
« Reply #17 on: 14 June 2019, 08:30:58 »
I can't think of a reason. It seems to be missing in scrollbar too.
Usually the state is called "down" instead of "pressed", but that might be unclear here.

Re: Kitchen Sink
« Reply #18 on: 14 June 2019, 09:23:05 »
I have some hard times with "ScrollablePanel"

Code: [Select]
Panel {
BackgroundColor = rgba(100, 100, 100, 255);
BorderColor        = rgba(0, 0, 0 , 255);
Borders              = (1, 1, 1, 1);
OpacityDisabled = 0.3
}

ScrollablePanel {
Panel = &Panel;
OpacityDisabled = 0.3
}

If i remove Panel property is working. With panel property is crashing. Panel alone is working fine.


Re: Kitchen Sink
« Reply #19 on: 14 June 2019, 10:24:52 »

Re: Kitchen Sink
« Reply #20 on: 14 June 2019, 12:43:02 »
I think knobs need some improvements.
When i pressed down left mouse the indicator must no be moved to the direction of mouse point but only if i start moving the mouse while it still down.
Also when i double click on them they should reset.
Also they must stop on min or max and not moving around.

*

texus

  • *****
  • 1400
    • View Profile
    • Texus's Blog
Re: Kitchen Sink
« Reply #21 on: 14 June 2019, 19:43:19 »
Quote
I have some hard times with "ScrollablePanel"
Theme files just don't work like that, you can't reference to another section (it would be nice if it was possible though, then you wouldn't have to repeat the information). It should look like this:
ScrollablePanel {
    BackgroundColor = rgba(100, 100, 100, 255);
    BorderColor     = rgba(0, 0, 0 , 255);
    Borders         = (1, 1, 1, 1);
    OpacityDisabled = 0.3;
}

Quote
I think knobs need some improvements.
Yeah, that widget didn't get much attention, it only has minimal functionality.

I haven't worked with knobs a lot, so it is possible that I'm disagreeing with some of these things due to lack of experience, but I don't agree that the improvements you suggest should be how the knob works. Maybe such behavior should be optional and even if I decide not to make them the default I could still add an option to make them work that way.

I can think of some situations where you would want such behavior, so maybe there are just 2 different types of knobs: those that simulate real-world knobs and those that just exist to select a value.
The kind of knob I tend to think about falls in the second category (examples, other example). They react immediately on mouse down and the value follows the mouse position, even if it crosses from 100% to 0% or passes through the center of the knob from 25% to 75%.

Quote
When i pressed down left mouse the indicator must no be moved to the direction of mouse point but only if i start moving the mouse while it still down.
I guess this also means that you want the knob to move based on how much you move the mouse as opposed to jumping straight to the mouse position?

Quote
Also when i double click on them they should reset.
Is this some kind of standard behavior somewhere? This could be done in user code if a DoubleClick event existed.

Quote
Also they must stop on min or max and not moving around.
That doesn't sound so easy to implement. It means the thumb must not jump to your mouse position but follow the movements you make. In such scenario I'm not sure how the thumb should respond if you move the mouse through the center of the knob to the other side.


Quote
Almost finished.
Looking even better.
I with I could run it in a browser and put it on the webpage. Maybe with TGUI 0.9, or maybe SFML adds support for emscripten, who knows.
Part of me still can't believe that that ListView was rendered with TGUI :)

Some more nitpicking:
- When you close the keyboard, the "Buttons" tab is no longer selected.
- In Misc2, shouldn't it say "Grid" instead of "Group"?

Re: Kitchen Sink
« Reply #22 on: 15 June 2019, 04:19:37 »
I think knobs deserve a separate thread because they are so cool.. 8)


Quote
- When you close the keyboard, the "Buttons" tab is no longer selected.
Code: [Select]
pTabBar->setEnabled(false);
pTabBar->setEnabled(true);

The above code kills the selected tab. When a tab bar goes disabled must not lose his selected index.

Thenk you for the ScrollablePanel info. It was so obvious that i was totally blind.


Code: [Select]
pScrollablePanelTheme = tgui::ScrollablePanel::copy(pScrollablePanel);
pScrollablePanelTheme->setRenderer(theme->getRenderer("ScrollablePanel"));
pScrollablePanelTheme->getRenderer()->setFont(*pFont);

The above code (setting new font) sets all text data in scrollpanel to lowercase.
Ha, just tested with label and is happening the same. I think is in all widgets cause they are sharing the same code.

*

texus

  • *****
  • 1400
    • View Profile
    • Texus's Blog
Re: Kitchen Sink
« Reply #23 on: 15 June 2019, 17:22:18 »
Quote
The above code kills the selected tab. When a tab bar goes disabled must not lose his selected index.
Fixed.

Quote
The above code (setting new font) sets all text data in scrollpanel to lowercase.
I can't reproduce it. I also don't see how the font could affect the string data. If the font you are setting has capital letters then you should create a minimal program and post it together with the font.

Re: Kitchen Sink
« Reply #24 on: 15 June 2019, 19:25:23 »
Quote
I can't reproduce it

My mistake. It was the font itself!!

http://www.mediafire.com/file/0dvv5r8cgfrtc2s/KitchenSink.rar/file

http://www.mediafire.com/file/ntc50fgol5a5iho/Run.rar/file

Here is the executable and the sources with vs 2015 project files.

You can tell me if i should change anything.

For instance.

SFML_libs.hpp can be removed.
defines.hpp  can be removed.
i use defineImprovedEnum.h. if that is a problem i 'll change all enums.


Oops just remember i didn't change the tgui dll in run folder with the latest one.
http://www.mediafire.com/file/3l8iblez3fmtooo/tgui.rar/file


« Last Edit: 15 June 2019, 19:29:56 by billarhos »

*

texus

  • *****
  • 1400
    • View Profile
    • Texus's Blog
Re: Kitchen Sink
« Reply #25 on: 17 June 2019, 22:45:09 »
- SFML_libs.hpp is specific to Visual Studio and should indeed be removed once this gets integrated with the TGUI examples which compile and link with cmake.
- defines.hpp should be removed. Not because the file is so small, but because I actually don't want to see SAFE_DELETE being used. TGUI tries to be a modern c++ library, it already requires c++14 as a minimum, so it would be best if the examples didn't use new and delete. Based on a quick glance at the code I think it could be replaced with std::unique_ptr.
- Why was defineImprovedEnum.h used? Are there places where it is used where a normal enum was be too limited?

Some minor comments:
- gnu-freefont_freeserif.zip and flags/Thumb.db in the resources folder can be removed I guess.
- Text colors of radio buttons in "Buttons" tab aren't the same (only the first one is really readable)
- The themed knob doesn't move correctly. ImageRotation in gui.txt should be 90, the current value seems to be a copy-paste error.
- I don't really like the horizontal scrollbar for ScrollablePanel as there is no contents to the right. Calling panel->setHorizontalScrollbarPolicy(Scrollbar::Policy::Never) would probably be better in this case (or changing the content width to not include the vertical scrollbar).
- A label with scrollbar would really look great on the first tab :)

I'll put a link to this forum topic on discord tomorrow so that your work gets a few more views.

Re: Kitchen Sink
« Reply #26 on: 17 June 2019, 23:16:12 »
Great.

I 'll make all the changes-corrections tomorrow.
Don't bother the others till i finished. They can see it completely. (As far as i can go it..)

Thanks Texus.

Re: Kitchen Sink
« Reply #27 on: 18 June 2019, 08:16:37 »
http://www.mediafire.com/file/56yxedvzmigbq32/KitchenSink.rar/file

Well i made all the changes.
I added "gnu-freefont_freeserif.zip" because it contains credit file for author and maybe it should added in resources.
Png flags file are mine so it will be no problem.
Also added some cool key events for each tab (space, left arrow, right arrow or enter depending on each tab).
You can select next tab with "Tab" key.

I really can not figure out why the label with scroll bar do not show the beginning of the text.
Also, i can't set min max form size on a message box.


« Last Edit: 18 June 2019, 08:22:45 by billarhos »

*

texus

  • *****
  • 1400
    • View Profile
    • Texus's Blog
Re: Kitchen Sink
« Reply #28 on: 18 June 2019, 18:32:15 »
Quote
I added "gnu-freefont_freeserif.zip" because it contains credit file for author and maybe it should added in resources.
I agree that the credits should be included, but that zip contains several different fonts of which only one is needed, so it is wasted space. Maybe the font should be moved to a new subfolder which would contain the README, FreeSerifBold.otf, CREDITS, COPYING and AUTHORS files. I don't think we need to keep the INSTALL, CHANGELOG and other font files. I would keep the README just because it contains the exception that allows the font to be used without requiring the program to be licensed under GPL.

Quote
I really can not figure out why the label with scroll bar do not show the beginning of the text.
I can't reproduce this. If I don't call setScrollbarPolicy then it only shows the start of the text as expected, but I don't know in what situation it would only show the end of the text.
Edit: I didn't look at the program yet, so I didn't see you already included the label. I'll have a look at the code later to figure out why it is happening.
Edit2: The issue is with setVerticalAlignment(Center), but you probably shouldn't be using that anyway when you have a vertical scrollbar.
Edit3: Fixed.

Quote
Also, i can't set min max form size on a message box.
Message box wasn't supposed to be resized and it's size would depend on the contents. A maximum size would be useful as it would allow word-wrapping on the text. For the label the behavior is simple, but I'm not sure what to do if the buttons exceed the size. The whole widget probably needs an overhaul, maybe also making the sizes of the buttons and the spaces between them configurable. So this probably isn't something that I would implement on short-term.
« Last Edit: 18 June 2019, 19:28:48 by texus »

Re: Kitchen Sink
« Reply #29 on: 18 June 2019, 19:45:18 »
Well, ok we leave knob and messagebox for later time.
Forgot to mention my theme knob doesn't behave correct, meaning it can't follow the mouse events as the non theme knob follows.

Apart from knob issue, i am done. I am open to any additions or changes. Please do not hesitate. If really something is not fitting in my code i would gladly change it.