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

Messages - texus

#1126
I made one more change to the code. You only selected a single space when double clicking, but if there are multiple whitespace next to each other then they should all be selected. I basically just reused the code that you wrote to select the entire word and made it do the inverse as well to select the whitespaces.

If you have a github account and know how to do it then you could send a pull request with the changes. Otherwise I will just commit the change myself but with your name on it. But I would need your name and email that you want on the git commit.

Quotetexus, will all of that were implemented in the future tgui's updates? ::) Cause it's very needful things, and I'd not like to do unnecessary inheritances or change sources every update ot other superfluous things. I think the other programmers too) ::)
QuoteI meant in any future and any update and even with any other code, etc.  I understand that it even may take time testing) Just to be comfortable control that will not scare the users of future applications)
I don't fully understand these sentences, so if there was still a question in it you should try to rephrase it.
#1127
Quotewill all of that were implemented in the future tgui's updates?
As soon as we both confirm that the changes are working then the changes will be added in tgui.

Could you send the full TextBox.cpp file so that we have the exact same version?

QuoteAnd how about EditBox? Can I try to add to it similar events?
Sure, feel free to change it too.
#1128
That PageDown issue wasn't very hard, the case where there are less lines than fill in the text box was just not checked.
I did find another rare crash with PageDown when there was a lot of text though, one that was much harder to reproduce, but I managed to fix it eventually. I just hope there aren't any other bugs like that one left.

Code (cpp) Select
            case sf::Keyboard::PageDown:
            {
                // Move to the bottom line when not there already
                if (m_topLine + m_visibleLines > m_lines.size())
                    m_selEnd.y = m_lines.size() - 1;
                else if (m_selEnd.y != m_topLine + m_visibleLines - 1)
                    m_selEnd.y = m_topLine + m_visibleLines - 1;
                else
                {
                    // Scroll down when we already where at the bottom line
                    Padding padding = getRenderer()->getScaledPadding();
                    auto visibleLines = static_cast<std::size_t>((getSize().y - padding.top - padding.bottom) / m_lineHeight);
                    if (m_selEnd.y + visibleLines >= m_lines.size() + 2)
                        m_selEnd.y = m_lines.size() - 1;
                    else
                        m_selEnd.y = m_selEnd.y + visibleLines - 2;
                }

                if (!m_lines[m_selEnd.y].isEmpty() && (m_lines[m_selEnd.y][m_lines[m_selEnd.y].getSize()-1] == '\n'))
                    m_selEnd.x = m_lines[m_selEnd.y].getSize() - 1;
                else
                    m_selEnd.x = m_lines[m_selEnd.y].getSize();

                if (!event.shift)
                    m_selStart = m_selEnd;

                updateSelectionTexts();
                break;
            }
#1129
QuoteI'm surprised such work speed
I have summer holiday right now so I have nothing better to do than playing games and working on tgui :)
Once university starts again next month I will hardly have any time to work on tgui so I try to make up for that during the summer holiday.

QuoteIt remains an issues with: "jumping-joining next line"
It took me some time to figure out where it had to be fixed, either the setPosition or the updateSelectionTexts function had to be changed but after changing my mind ten times about which one was easier to change I ended up just choosing updateSelectionTexts. The fix is actually only 3 insertions, but I'll send the entire function so that you don't have to try to figure out where to make the change.
Code (cpp) Select
    void TextBox::updateSelectionTexts()
    {
        Padding padding = getRenderer()->getScaledPadding();

        float maxLineWidth = std::max(0.f, getSize().x - padding.left - padding.right);
        if (m_scroll && (!m_scroll->getAutoHide() || (m_scroll->getMaximum() > m_scroll->getLowValue())))
            maxLineWidth = std::max(0.f, maxLineWidth - m_scroll->getSize().x);

        // If there is no selection then just put the whole text in m_textBeforeSelection
        if (m_selStart == m_selEnd)
        {
            sf::String displayedText;
            for (std::size_t i = 0; i < m_lines.size(); ++i)
            {
                if (((m_lines[i] != "") && (m_lines[i][m_lines[i].getSize()-1] == '\n')) || (i == m_lines.size()-1))
                    displayedText += m_lines[i];
                else
                    displayedText += m_lines[i] + "\n";
            }

            m_textBeforeSelection.setString(displayedText);
            m_textSelection1.setString("");
            m_textSelection2.setString("");
            m_textAfterSelection1.setString("");
            m_textAfterSelection2.setString("");
        }
        else // Some text is selected
        {
            auto selectionStart = m_selStart;
            auto selectionEnd = m_selEnd;

            if ((m_selStart.y > m_selEnd.y) || ((m_selStart.y == m_selEnd.y) && (m_selStart.x > m_selEnd.x)))
                std::swap(selectionStart, selectionEnd);

            // Set the text before the selection
            if (selectionStart.y > 0)
            {
                sf::String string;
                for (std::size_t i = 0; i < selectionStart.y; ++i)
                {
                    if ((m_lines[i] != "") && (m_lines[i][m_lines[i].getSize()-1] == '\n'))
                        string += m_lines[i];
                    else
                        string += m_lines[i] + "\n";
                }

                string += m_lines[selectionStart.y].substring(0, selectionStart.x);
                m_textBeforeSelection.setString(string);
            }
            else
                m_textBeforeSelection.setString(m_lines[0].substring(0, selectionStart.x));

            // Set the selected text
            if (m_selStart.y == m_selEnd.y)
            {
                m_textSelection1.setString(m_lines[selectionStart.y].substring(selectionStart.x, selectionEnd.x - selectionStart.x));
                m_textSelection2.setString("");
            }
            else
            {
                if (!m_lines[selectionStart.y].isEmpty() && (m_lines[selectionStart.y][m_lines[selectionStart.y].getSize()-1] != '\n') && (selectionEnd.y > selectionStart.y))
                    m_textSelection1.setString(m_lines[selectionStart.y].substring(selectionStart.x, m_lines[selectionStart.y].getSize() - selectionStart.x) + '\n');
                else
                    m_textSelection1.setString(m_lines[selectionStart.y].substring(selectionStart.x, m_lines[selectionStart.y].getSize() - selectionStart.x));

                sf::String string;
                for (std::size_t i = selectionStart.y + 1; i < selectionEnd.y; ++i)
                {
                    if ((m_lines[i] != "") && (m_lines[i][m_lines[i].getSize()-1] == '\n'))
                        string += m_lines[i];
                    else
                        string += m_lines[i] + "\n";
                }

                string += m_lines[selectionEnd.y].substring(0, selectionEnd.x);

                m_textSelection2.setString(string);
            }

            // Set the text after the selection
            {
                m_textAfterSelection1.setString(m_lines[selectionEnd.y].substring(selectionEnd.x, m_lines[selectionEnd.y].getSize() - selectionEnd.x));

                sf::String string;
                for (std::size_t i = selectionEnd.y + 1; i < m_lines.size(); ++i)
                {
                    if (((m_lines[i] != "") && (m_lines[i][m_lines[i].getSize()-1] == '\n')) || (i == m_lines.size()-1))
                        string += m_lines[i];
                    else
                        string += m_lines[i] + "\n";
                }

                m_textAfterSelection2.setString(string);
            }
        }

        // Check if the caret is located above or below the view
        if (m_scroll != nullptr)
        {
            if (m_selEnd.y <= m_topLine)
                m_scroll->setValue(static_cast<unsigned int>(m_selEnd.y * m_lineHeight));
            else if (m_selEnd.y + 1 >= m_topLine + m_visibleLines)
                m_scroll->setValue(static_cast<unsigned int>(((m_selEnd.y + 1) * m_lineHeight) - m_scroll->getLowValue()));
        }

        updatePosition();
    }
#1130
I rewrote some parts of the keyPressed function, you should check if your problems are gone and if everything still works as it should (I changed some details in behavior).
Code (cpp) Select
    void TextBox::keyPressed(const sf::Event::KeyEvent& event)
    {
        switch (event.code)
        {
            case sf::Keyboard::Up:
            {
                if (m_selEnd.y > 0)
                    m_selEnd = findCaretPosition({m_caretPosition.x, m_caretPosition.y - m_lineHeight});
                else
                    m_selEnd = {0, 0};

                if (!event.shift)
                    m_selStart = m_selEnd;

                updateSelectionTexts();
                break;
            }

            case sf::Keyboard::Down:
            {
                if (m_selEnd.y < m_lines.size()-1)
                    m_selEnd = findCaretPosition({m_caretPosition.x, m_caretPosition.y + m_lineHeight});
                else
                    m_selEnd = sf::Vector2<std::size_t>(m_lines[m_lines.size()-1].getSize(), m_lines.size()-1);

                if (!event.shift)
                    m_selStart = m_selEnd;

                updateSelectionTexts();
                break;
            }

            case sf::Keyboard::Left:
            {
                if (event.control)
                {
                    // Move to the beginning of the word (or to the previous word when already at the beginning)
                    bool skippedWhitespace = false;
                    bool done = false;
                    for (unsigned int j = m_selEnd.y + 1; j > 0; --j)
                    {
                        for (unsigned int i = m_selEnd.x; i > 0; --i)
                        {
                            if (skippedWhitespace)
                            {
                                if (isWhitespace(m_lines[m_selEnd.y][i-1]))
                                {
                                    m_selEnd.x = i;
                                    done = true;
                                    break;
                                }
                            }
                            else
                            {
                                if (!isWhitespace(m_lines[m_selEnd.y][i-1]))
                                    skippedWhitespace = true;
                            }
                        }

                        if (!done)
                        {
                            if (m_selEnd.y > 0)
                            {
                                m_selEnd.y--;
                                if (!m_lines[m_selEnd.y].isEmpty() && m_lines[m_selEnd.y][m_lines[m_selEnd.y].getSize()-1] == '\n')
                                {
                                    if (!skippedWhitespace)
                                        m_selEnd.x = m_lines[m_selEnd.y].getSize()-1;
                                    else
                                    {
                                        m_selEnd.x = 0;
                                        m_selEnd.y++;
                                        break;
                                    }
                                }
                                else
                                    m_selEnd.x = m_lines[m_selEnd.y].getSize();
                            }
                            else
                            {
                                m_selEnd.x = 0;
                                m_selEnd.y = 0;
                            }
                        }
                        else
                            break;
                    }
                }
                else
                {
                    if (m_selEnd.x > 0)
                        m_selEnd.x--;
                    else
                    {
                        // You are at the left side of a line so move up
                        if (m_selEnd.y > 0)
                        {
                            m_selEnd.y--;
                            m_selEnd.x = m_lines[m_selEnd.y].getSize() - 1;
                        }
                    }
                }

                if (!event.shift)
                    m_selStart = m_selEnd;

                updateSelectionTexts();
                break;
            }

            case sf::Keyboard::Right:
            {
                // You can still move to the right on this line
                if (event.control)
                {
                    // Move to the beginning of the word (or to the previous word when already at the beginning)
                    bool skippedWhitespace = false;
                    bool done = false;
                    for (unsigned int j = m_selEnd.y; j < m_lines.size(); ++j)
                    {
                        for (unsigned int i = m_selEnd.x; i < m_lines[m_selEnd.y].getSize(); ++i)
                        {
                            if (skippedWhitespace)
                            {
                                if (isWhitespace(m_lines[m_selEnd.y][i]))
                                {
                                    m_selEnd.x = i;
                                    done = true;
                                    break;
                                }
                            }
                            else
                            {
                                if (!isWhitespace(m_lines[m_selEnd.y][i]))
                                    skippedWhitespace = true;
                            }
                        }

                        if (!done)
                        {
                            if (!skippedWhitespace)
                            {
                                if (m_selEnd.y+1 < m_lines.size())
                                {
                                    m_selEnd.y++;
                                    m_selEnd.x = 0;
                                }
                            }
                            else
                            {
                                if (!m_lines[m_selEnd.y].isEmpty() && (m_lines[m_selEnd.y][m_lines[m_selEnd.y].getSize()-1] == '\n'))
                                    m_selEnd.x = m_lines[m_selEnd.y].getSize() - 1;
                                else
                                    m_selEnd.x = m_lines[m_selEnd.y].getSize();
                            }
                        }
                        else
                            break;
                    }
                }
                else
                {
                    // Move to the next line if you are at the end of the line
                    if ((m_selEnd.x == m_lines[m_selEnd.y].getSize()) || ((m_selEnd.x+1 == m_lines[m_selEnd.y].getSize()) && (m_lines[m_selEnd.y][m_selEnd.x] == '\n')))
                    {
                        if (m_selEnd.y < m_lines.size()-1)
                        {
                            m_selEnd.y++;
                            m_selEnd.x = 0;
                        }
                    }
                    else
                        m_selEnd.x++;
                }

                if (!event.shift)
                    m_selStart = m_selEnd;

                updateSelectionTexts();
                break;
            }

            case sf::Keyboard::Home:
            {
                if (event.control)
                    m_selEnd = {0, 0};
                else
                    m_selEnd.x = 0;

                if (!event.shift)
                    m_selStart = m_selEnd;

                updateSelectionTexts();
                break;
            }

            case sf::Keyboard::End:
            {
                if (event.control)
                    m_selEnd = {m_lines[m_lines.size()-1].getSize(), m_lines.size()-1};
                else
                {
                    if (!m_lines[m_selEnd.y].isEmpty() && (m_lines[m_selEnd.y][m_lines[m_selEnd.y].getSize()-1] == '\n'))
                        m_selEnd.x = m_lines[m_selEnd.y].getSize() - 1;
                    else
                        m_selEnd.x = m_lines[m_selEnd.y].getSize();
                }

                if (!event.shift)
                    m_selStart = m_selEnd;

                updateSelectionTexts();
                break;
            }

            case sf::Keyboard::PageUp:
            {
                // Move to the top line when not there already
                if (m_selEnd.y != m_topLine)
                    m_selEnd.y = m_topLine;
                else
                {
                    // Scroll up when we already where at the top line
                    Padding padding = getRenderer()->getScaledPadding();
                    auto visibleLines = static_cast<std::size_t>((getSize().y - padding.top - padding.bottom) / m_lineHeight);
                    if (m_topLine < visibleLines - 1)
                        m_selEnd.y = 0;
                    else
                        m_selEnd.y = m_topLine - visibleLines + 1;
                }

                m_selEnd.x = 0;

                if (!event.shift)
                    m_selStart = m_selEnd;

                updateSelectionTexts();
                break;
            }

            case sf::Keyboard::PageDown:
            {
                // Move to the bottom line when not there already
                if (m_selEnd.y != m_topLine + m_visibleLines - 1)
                    m_selEnd.y = m_topLine + m_visibleLines - 1;
                else
                {
                    // Scroll down when we already where at the bottom line
                    Padding padding = getRenderer()->getScaledPadding();
                    auto visibleLines = static_cast<std::size_t>((getSize().y - padding.top - padding.bottom) / m_lineHeight);
                    if (m_selEnd.y + visibleLines >= m_lines.size() + 2)
                        m_selEnd.y = m_lines.size() - 1;
                    else
                        m_selEnd.y = m_topLine + m_visibleLines + visibleLines - 2;
                }

                if (!m_lines[m_selEnd.y].isEmpty() && (m_lines[m_selEnd.y][m_lines[m_selEnd.y].getSize()-1] == '\n'))
                    m_selEnd.x = m_lines[m_selEnd.y].getSize() - 1;
                else
                    m_selEnd.x = m_lines[m_selEnd.y].getSize();

                if (!event.shift)
                    m_selStart = m_selEnd;

                updateSelectionTexts();
                break;
            }

            case sf::Keyboard::Return:
            {
                textEntered('\n');
                break;
            }

            case sf::Keyboard::BackSpace:
            {
                if (m_readOnly)
                    break;

                // Make sure that we did not select any characters
                if (m_selStart == m_selEnd)
                {
                    // Delete the previous character on this line
                    if (m_selEnd.x > 0)
                    {
                        m_selEnd.x--;
                    }
                    else // We are at the left side of the line
                    {
                        // Delete a character from the line above you
                        if (m_selEnd.y > 0)
                        {
                            m_selEnd.y--;
                            m_selEnd.x = m_lines[m_selEnd.y].getSize() - 1;
                        }
                        else // You are at the beginning of the text
                            break;
                    }

                    m_selStart = m_selEnd;
                    m_text.erase(findTextCaretPosition().second, 1);
                    rearrangeText(true);
                }
                else // When you did select some characters then delete them
                    deleteSelectedCharacters();

                // The caret should be visible again
                m_caretVisible = true;
                m_animationTimeElapsed = {};

                m_callback.text = m_text;
                sendSignal("TextChanged", m_text);
                break;
            }

            case sf::Keyboard::Delete:
            {
                if (m_readOnly)
                    break;

                // Make sure that no text is selected
                if (m_selStart == m_selEnd)
                {
                    // Delete the next character on this line
                    if (m_selEnd.x == m_lines[m_selEnd.y].getSize())
                    {
                        // Delete a character from the line below you
                        if (m_selEnd.y < m_lines.size()-1)
                        {
                            m_selEnd.y++;
                            m_selEnd.x = 0;

                            m_selStart = m_selEnd;
                        }
                        else // You are at the end of the text
                            break;
                    }

                    m_text.erase(findTextCaretPosition().second, 1);
                    rearrangeText(true);
                }
                else // You did select some characters, so remove them
                    deleteSelectedCharacters();

                m_callback.text = m_text;
                sendSignal("TextChanged", m_text);
                break;
            }

            case sf::Keyboard::A:
            {
                if (event.control)
                {
                    m_selStart = {0, 0};
                    m_selEnd = sf::Vector2<std::size_t>(m_lines[m_lines.size()-1].getSize(), m_lines.size()-1);
                    updateSelectionTexts();
                }

                break;
            }

            case sf::Keyboard::C:
            {
                if (event.control)
                    Clipboard::set(m_textSelection1.getString() + m_textSelection2.getString());

                break;
            }

            case sf::Keyboard::X:
            {
                if (event.control && !m_readOnly)
                {
                    Clipboard::set(m_textSelection1.getString() + m_textSelection2.getString());
                    deleteSelectedCharacters();
                }

                break;
            }

            case sf::Keyboard::V:
            {
                if (event.control && !m_readOnly)
                {
                    sf::String clipboardContents = Clipboard::get();

                    // Only continue pasting if you actually have to do something
                    if ((m_selStart != m_selEnd) || (clipboardContents != ""))
                    {
                        deleteSelectedCharacters();

                        m_text.insert(findTextCaretPosition().first, clipboardContents);
                        m_lines[m_selStart.y].insert(m_selStart.x, clipboardContents);

                        m_selStart.x += clipboardContents.getSize();
                        m_selEnd = m_selStart;
                        rearrangeText(true);

                        m_callback.text = m_text;
                        sendSignal("TextChanged", m_text);
                    }
                }

                break;
            }

            default:
                break;
        }

        // The caret should be visible again
        m_caretVisible = true;
        m_animationTimeElapsed = {};
    }
#1131
I'll see if I can fix those things.

QuoteIf the caret at the space then the word by left side will be selected
Is there an editor that works like that or is this just a side-effect of the code? The text editor that I use (gedit) selects the whitespace itself when the cursor is on the left of the space or between multiple spaces.

Btw, I fixed your post. You needed to remove both the list tags in the beginning and their corresponding /list tags somewhere in the middle together.

Edit: Your code is also giving warnings on lines 504 and 722 since the unsigned int is always equal or bigger than 0. If the break isn't called then it will crash. I'll fix the one on 722 together with the other things that I have to fix in that function, but perhaps you could have a look at 504 if you also want to change the behavior of the double clicking on space? Of course if you don't want to then I will look into both.
#1132
Since I would have probably heard if someone would have, I guess it is safe to say that there isn't one for v0.7-dev.

If you use v0.6 then TGUI comes with a simple Form Builder, for windows there is an exe in the form-builder folder and for other OSes you have to check the TGUI_BUILD_FORM_BUILDER in CMake.

But the form builder is a big project, the one in v0.6 is still limited to simple screens and it is too much work to maintain it for future tgui versions. So it is no longer being developed and already dropped in the v0.7-dev branch because I simply don't have the time to maintain it, I already have too little time to just develop the gui without the form builder.
#1133
Correct, all functions that change the look of the widget are in the Renderer class which you access with getRenderer().

Unlike in v0.6 you can now change every property dynamically, this lead to a lot of functions which is why I decided to put them in a separate class. The widgets and their renderer classes could perfectly be merged but it would result in a lot of functions in the class which you probably never use, making it harder to find functionality of the widget.
#1134
This is only needed when using opengl directly and all examples use only sfml, that is why it is never mentioned.

I guess I can add an opengl example, I'm currently reorganizing the site anyway.
But as the SFML tuturial says, in more complex situations you need more than just the push/pop from sfml, so it is hard to document what you need to do exactly.
#1135
There is no way around it. SFML uses opengl itself and to not make it interfere with your custom opengl code you need the push and pop.
#1136
Since TGUI just renders with SFML I guess the problem would be that you are not saving the gl states: https://www.sfml-dev.org/tutorials/2.3/window-opengl.php#using-opengl-together-with-the-graphics-module
#1137
Help requests / Re: TGUI on raspberry pi
25 August 2015, 13:29:05
The mac errors should be fixed now.

Quote/usr/local/lib/libtgui.so: undefined reference to `sf::String::substring(unsigned int, unsigned int) const'
/usr/local/lib/libtgui.so: undefined reference to `sf::Image::~Image()'
You should really double check that there isn't any older SFML version installed on your pc, it seems to find SFML 2.0 or 2.1 somewhere.
#1138
Help requests / Re: TGUI on raspberry pi
25 August 2015, 12:35:08
QuoteI used the FindSFML module to detect SFML (I took the module from the TGUI repo). It was the source of the bug. I solved the problem by doing the library linking directly
I didn't though of this before, but the FindSFML.cmake in TGUI is the one that ships with SFML 2.3. I know that is could no longer find SFML 2.1 (https://github.com/SFML/SFML/issues/950) but maybe it also affects SFML 2.2.
Edit: Sorry, you aren't using SFML 2.2 I guess, that was someone else on this forum apparently.

QuoteBut know I am having an issue linking TGUI
These errors would indicate that TGUI finds header files of SFML 2.2 or higher while the SFML library you link with is 2.0 or 2.1.

QuoteSo I am trying to switch on TGUI v0.7-dev but I am having an error building it on my mac
The mac version was tested on Yosemite, do you perhaps have an older mac version? I'll try and see if I can still compile it with Mountain Lion.
#1139
Help requests / Re: TGUI on raspberry pi
24 August 2015, 18:34:53
When building sfml did you check SFML_OPENGL_ES? The only way that TGUI 0.6 could work on the raspberry pi is when you are using normal opengl and not opengl es. But desktop opengl is not hardware accelerated on raspberry pi, so isn't sfml super slow (like only a few frames per second?). TGUI 0.7-dev has also been given the TGUI_OPENGL_ES option to build for opengl es which is hardware accelerated.

QuoteIt works perfectly
I changed the main of my project with the example code. And it still get the error !
What example code are you talking about exactly? You should try to change the working version line by line until it fails, only then will you really know what is going wrong.

I have 2 raspberries lying around here but neither has an OS installed on them currently so I can't test it myself yet.
#1140
Help requests / Re: TGUI on raspberry pi
24 August 2015, 17:21:56
I just realized something, you are using tgui 0.6 right?
I wonder how you even managed to build it on the raspberry pi, did you install mesa opengl drivers to use software rendering?

You need tgui 0.7-dev for which you have to check the TGUI_OPENGL_ES option. You might also have to point cmake to the correct libraries yourself (which were somewhere in the /opt folder if I'm correct).
#1141
Help requests / Re: TGUI on raspberry pi
24 August 2015, 16:37:30
QuoteI had a working version of SFML before I added TGUI.
Then you should try to figure out where it goes wrong. Start with an sfml app, test it, link to tgui, test it, include tgui, test it, create a gui object, test it, ...
#1142
Help requests / Re: Change setText on clic
24 August 2015, 16:04:15
This is due to some technical detail in C++, for a quick explanation read the Connecting member functions part from the v0.7-dev tutorial.

The line would have to be:
Code (cpp) Select
startbutton->bindCallback(std::bind(&SystemGui::linkStartButton, this, startbutton), tgui::Button::LeftMouseClicked);
#1143
Help requests / Re: TGUI on raspberry pi
24 August 2015, 15:46:37
I did have TGUI working on a raspberry pi some time ago, so it should be possible.

But doesn't that error come when trying to create the sfml window?

I'm not sure about the current state but when I tried it I needed an adapted sfml version (which someone put on the sfml forum) in order to get sfml to work. And it only worked for fullscreen windows.
#1144
Checking TGUI_SHARED_LIBS means that it builds libraries for dynamic linking, so that seems to be ok.

I'm starting to run out of ideas on where the issue could be.
Could you find out which line is causing the opengl error (by debugging or by putting couts in the program)?
What is the exact download link for your compiler? CodeBlocks is just the IDE and by mentioning cygwin I don't think you have the compiler that ships with codeblocks (even if you do then there are two different versions).
Could you send me the .cbp file of your project?

Unless the location of the opengl error tells me something more I will have to try and reproduce the problem here, I guess I should start installing another windows in virtualbox.

Edit: Just to be 100% certain that there isn't a line missing, could you also post the exact code that you are compiling here?
#1145
Help requests / Re: Change setText on clic
21 August 2015, 16:23:27
It's because a callback is only buffered for later retrieval in the callback loop when you don't pass a function to bindCallback.

The callback loop is actually kindof depreciated, it no longer exists in v0.7-dev.

You should read the callback tutorial for more information.
#1146
Help requests / Re: Change setText on clic
21 August 2015, 16:00:28
Just so that you don't get similar problems later on: the get function returns a Widget which is the base class of all widgets and thus has no setText function. It should first be cast to a Button, but there is a function in tgui that does that for you in one step:
Code (cpp) Select
_gui.get<tgui::Button>("startbutton")->setText("Stop");
#1147
Help requests / Re: Change setText on clic
21 August 2015, 15:40:56
Doesn't that code work?

Anyway, it's probably better to connect a function instead of using the pollCallback for things like this. Something like this:
Code (cpp) Select
void func(tgui::Button::Ptr button)
{
    if (button->getText() == "Start")
        button->setText("Stop");
    else
        button->setText("Start");
}

startbutton->bindCallback(std::bind(func, startbutton), tgui::Button::LeftMouseClicked);


You might want to learn about std::bind if you don't know how to use it yet, it allows binding practiacally anything which is why tgui relies on it.
#1148
I can only guess with issues like these. The line where it fails doesn't make much sense either.

Can you still use sf::Sprite and such without problems inside a program that uses TGUI?
Are you sure you are not mixing debug and release or static and dynamic linking?
What compiler version do you have exactly?

If you have multiple SFML versions on your pc, open cmake, set the build directory where tgui was build, check the "Advanced" checkbox and look at the SFML_INCLUDE_DIR and the SFML_[COMPONENT]_LIBRARY_[DYNAMIC/STATIC]_[DEBUG/RELEASE] options. Make sure that they contain the correct SFML directories (or are set to the NOTFOUND value when they are not available).
#1149
Do you get that error once or multiple times?
Can you use sf::Texture, sf::Sprite and sf::Text in a normal SFML program without TGUI?

I suspect that this will be due to your graphics drivers, so you should try updating them.
#1150
The bug is now fixed, knowing that it happened at the end of a paragraph was enough to reproduce it here and thus quickly find the issue.

Inside tgui only '\n' is used so this was not related to windows. The problem happened because the contents of the line contains '\n' at the end. While you see e.g. 5 characters on the screen, the line will contain 6 characters because it also contains the newline. The caret is at position 5 and when pressing the right arrow key the code just checked if it was at the end of the line (which it isn't technically) and move it forward. The problem was solved by skipping the '\n' at the end of the line.