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 - Blaxxun

#1
Help requests / tgui::EditBox signal on Unfocused
19 November 2019, 19:57:37
Hello forum,

I have an EditBox to enter color values from 0 to 255.

I need to check for correct value entry by the user which i can do with "ReturnKeyPressed".
But if the user just clicks outside the Box and it looses focus i dont have a signal.

Can this be done somehow?

"TextChanged" is not really helpful in my case.

Thanks!
#2
Hello forum,

I have a BitmapButton and a keyboard shortcut. (I want to create a toggle button)
Just using the button with the mouse works fine.
Using a keyboard shortcut i cant access the BitmapButton properly (crash).
My goal is to toggle the image of the button everytime when the shortcut is pressed.

This minimal code works fine:

tgui::BitmapButton::Ptr BBTN_Erase = tgui::BitmapButton::create();

BBTN_Erase->setImage("img/BTN_Eraser.png");
BBTN_Erase->setImageScaling(0);
BBTN_Erase->connect("pressed", [&]()
{
if (EraserON)
{
EraserON = false;
BBTN_Erase->setImage("img/BTN_Eraser.png");
}
else
{
EraserON = true;
BBTN_Erase->setImage("img/BTN_EraserON.png");
}
});
gui.add(BBTN_Erase);



And this code throws an exeption:
if (event.key.code == sf::Keyboard::E)
{
if (EraserON)
{
EraserON = false;
tgui::BitmapButton::Ptr BBTN_Erase = gui.get<tgui::BitmapButton>("BTTN_Erase");
BBTN_Erase->setImage("img/BTN_Eraser.png");
}
else
{
EraserON = true;
tgui::BitmapButton::Ptr BBTN_Erase = gui.get<tgui::BitmapButton>("BTTN_Erase");
BBTN_Erase->setImage("img/BTN_EraserON.png");
}
}


What am i doing wrong?

Thanks!!  :)