Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - wizzard

#1
I want to know if any widgets in a Gui have focus. If not, I allow my game engine to handle events. I currently do this by looping through all the widgets in the Gui. I was disappointed to see how Gui::hasFocus worked.
#2
I keep getting fooled into thinking that I can type in my client window when it isn't selected.
This is because the caret is flashing even though the window does not have focus.
The EditBox should still use its focused images, but I just wish that the selection point would stop flashing.
#3
I do a lot of template work with TGUI since I expose it to the Squirrel scripting language using them.

When I look at the documentation, I see functions like the following
tgui::Container::focusWidget
tgui::Container::remove

These functions have undocumented (internal) overloads that are exposed.
So, when I go to shove them into my templates they do not work because of template ambiguity.
With these functions, I can just define the template of the function I want bound.
Anyways, the problem I have is that it took awhile for me to realize they had internal overloads.
In addition, I'm pretty sure IDE auto-completion will see the internal overloads and recommend them.

SFML handles internal functions by putting them in a "priv" namespace.
I think it'd be a good idea to instead append "Internal" to all the internal functions.
(e.g. tgui::Container::focusWidgetInternal)
#4
Feature requests / Automatic doxygen usage in CMake
18 September 2013, 17:10:09
SFML has it so CMake automatically tells the makefile to compile the documentation for it.

It'd be a tad cooler if TGUI did that too. I can just do mingw32-make install and it puts all the documentation in a folder.
#5
I think there should be a way to get lines in the ChatBox so I can implement my own copy and pasting functionality.
It would also be nice to have a callback for when a line is right-clicked.
#6
Hello,

I'm trying to get chat boxes to scroll with the mouse wheel.
Currently, the scroll bar thumb must be clicked and dragged to move the chat box contents.
I see there exists this function

    void tgui::ChatBox::mouseWheelMoved(int delta);

However, I do not know how to activate it properly.
I'm using the following code and playing around everywhere with the mouse wheel with no effect:
#include <TGUI/TGUI.hpp>

#define THEME_CONFIG_FILE "widgets/Black.conf"

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "TGUI window");
    tgui::Gui gui(window);

    if (gui.setGlobalFont("fonts/DejaVuSans.ttf") == false)
        return 1;

    tgui::ChatBox::Ptr chatbox(gui);
    chatbox->load(THEME_CONFIG_FILE);
    chatbox->setSize(200, 100);
    chatbox->setTextSize(20);
    chatbox->setPosition(400, 25);
    chatbox->addLine("Line 1", sf::Color::Red);
    chatbox->addLine("Line 2", sf::Color::Blue);
    chatbox->addLine("Line 3", sf::Color::Green);
    chatbox->addLine("Line 4", sf::Color::Yellow);
    chatbox->addLine("Line 5", sf::Color::Cyan);
    chatbox->addLine("Line 6", sf::Color::Magenta);

    while (window.isOpen()) {
        sf::Event event;
        while (window.pollEvent(event)) {
            if (event.type == sf::Event::Closed)
                window.close();

            gui.handleEvent(event);
        }

        window.clear();
        gui.draw();
        window.display();
    }

    return 0;
}


I noticed that tgui::EventManager::handleEvent has the following code

        // Check for mouse wheel scrolling
        else if (event.type == sf::Event::MouseWheelMoved)
        {
            // Find the widget under the mouse
            Widget::Ptr widget = mouseOnWidget(static_cast<float>(event.mouseWheel.x), static_cast<float>(event.mouseWheel.y));
            if (widget != nullptr)
            {
                // Send the event to the widget
                widget->mouseWheelMoved(event.mouseWheel.delta, event.mouseWheel.x,  event.mouseWheel.y);
                return true;
            }

            return false;
        }


So, it seems like the feature is there already. I just don't know how to activate it.
Maybe the widget under the mouse is never set to a non-null value?
#7
I was using an EditBox in a ChildWindow today and I wanted to make it so that when the ChildWindow pops up, the EditBox would automatically get keyboard focus so that one does not have to explicitly click on the EditBox to start putting text into it.
I assumed that EditBox::Focus would do the job but it only gave the appearance that the EditBox was selected (its border gets darker when selected).
So, I also tried EditBox::enable and EditBox::show but neither of those worked too.
Its really inconvenient to the user to not have this as it is to be expected out of the type of dialog that I am giving.
I'm not sure if this is a bug or a new feature or if I missed how to do it.
#8
When using TGUI in a window and not full-screen, I think that child windows that are being dragged should stop being dragged when the mouse leaves the rendering region.
I can continually drag around a window if my left mouse button is not down if I just release my mouse outside of the window.

Edit: So, my fix would be just detecting MouseLeft events with the ChildWindow and then stop dragging when they are detected.
#9
In my game editor, I want events that the GUI uses to be ignored by the game editor. So, if there is a window there and you have the object placing tool in use, objects won't be placed behind the window when you are clicking on the window. I can do this currently but it requires doing a bunch of bounds checking and stuff outside of TGUI that TGUI already does internally. It'd be nice if a bool was returned that told me whether an event was a GUI-only event or not.