I can't reproduce it here. Could you show the lines where you create the knob? Maybe the problem is specific to the minimum, maximum, start rotation and end rotation that you are using.
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
Quote/usr/local/include/TGUI/ClickableWidget.hpp:90:29: error: ‘virtual tgui::Widget::Ptr tgui::ClickableWidget::clone()’ marked ‘override’, but does not overrideThis error occurs because there is a "const" missing behind the function, but not only is there a "const" in the latest version, it is also located on line 96 and not line 90 like the error suggests.
virtual Widget::Ptr clone() override
knob->setMaximum(128-8);scrollbar->setValue((128 - 8) - value);QuoteVC12That is not going to work. On windows the c++ compiler you use for your program has to be the same one as all your libraries. You can't combine libraries meant for different visual studio compilers. It could lead to random behavior so this might be your problem.
VC14
QuoteTried "std::static_pointer_cast" but doesn't work( it compile, but have no effect)It is the correct way and if it compiles with TableRow but not with Widget then there must me a mistake somewhere with the function you are calling. There is one thing that could cause stange results though: did you forget to add "typedef std::shared_ptr<TableRow> Ptr;" to the TableRow class? If you forgot that then TableRow::Ptr is actually the same as Widget::Ptr which is why the cast wouldn't make any difference.
QuoteIt would be best that this are 2 different functions, setTextSize and setFont. When setTextSize is called and there is still no font nothing happens but the size is stored. When setFont is called (or when setTextSize gets called while there already is a font) then it should do what you currently do in setFontSize. But I can easily make changes like this myself when it is finished, so it doesn't matter that it requires such a function now.table->setFontSize(18, mGui.getFont());
in order to everything to work properly.
Quoteif to set the table row height to 'fixed' or 'auto' and if is fixed to set all the widgets size to that size, and if auto, the table to check what is the biggest height and apply to all rows.Another option that the user might want is having all rows fixed but just have that one row a bit bigger. But I guess the 'fixed' and 'auto' options would be more common than this so it is enough to have them.
QuoteBoxLayout which contains only 1 widget
Quoteit would be nice if you would add padding properties to BoxLayoutWhy does it has to be in a BoxLayout when there is only one widget? The BoxLayout is created to place widgets next to each other or below to each other, not to store single widgets.
#include <TGUI/TGUI.hpp>
tgui::ListBox::Ptr popumMenu;
void popupMenuCallback(std::string item)
{
std::cout << item << std::endl;
}
void rightClickCallback(tgui::Gui& gui, sf::Vector2f position)
{
popumMenu = std::make_shared<tgui::ListBox>();
popumMenu->addItem("Option 1");
popumMenu->addItem("Option 2");
popumMenu->addItem("Option 3");
popumMenu->addItem("Option 4");
popumMenu->setItemHeight(20);
popumMenu->setPosition(position);
popumMenu->setSize(120, popumMenu->getItemHeight() * popumMenu->getItemCount());
popumMenu->connect("ItemSelected", popupMenuCallback);
gui.add(popumMenu);
}
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "TGUI window");
tgui::Gui gui(window);
gui.setFont("TGUI/fonts/DejaVuSans.ttf");
while(window.isOpen())
{
sf::Event event;
while(window.pollEvent(event))
{
if(event.type == sf::Event::Closed)
window.close();
// Check if there is a pop-up menu
if (popumMenu)
{
// When mouse is released, remove the pop-up menu
if (event.type == sf::Event::MouseButtonReleased && event.mouseButton.button == sf::Mouse::Left)
{
gui.remove(popumMenu);
popumMenu = nullptr;
}
// When mouse is pressed, remove the pop-up menu only when the mouse is not on top of the menu
if (event.type == sf::Event::MouseButtonPressed)
{
if (!popumMenu->mouseOnWidget(event.mouseButton.x, event.mouseButton.y))
{
gui.remove(popumMenu);
popumMenu = nullptr;
}
}
}
// Perhaps we have to open a menu
else if (event.type == sf::Event::MouseButtonPressed && event.mouseButton.button == sf::Mouse::Right)
{
rightClickCallback(gui, sf::Vector2f(event.mouseButton.x, event.mouseButton.y));
}
gui.handleEvent(event);
}
window.clear();
gui.draw();
window.display();
}
}