In my event polling part i have something looking like this at the moment. It does its work nicely:
while(this->window.pollEvent(event)) {
switch(event.type) {
case sf::Event::TextEntered:
if (gui.selectedItem.type == GUI_TEXTFIELD) {
gui.handleTextEntered(event.text.unicode);
}
break;
}
}
And then in my gui class the handleTextEntered function looks a bit like this:
void GuiClass::handleTextEntered(sf::Uint32 key) {
if (key >= 128 || key == 27 || key == 13) return;
if (key == 8) {
if (wins[selectedItem.win].textfields[selectedItem.nr].text != "")
wins[selectedItem.win].textfields[selectedItem.nr].text.erase(wins[selectedItem.win].textfields[selectedItem.nr].text.getSize()-1, 1);
return;
}
if (selectedItem.type == GUI_TEXTFIELD) {
wins[selectedItem.win].textfields[selectedItem.nr].text += static_cast<char>(key);
}
}
It's a bit crude and requires an overhaul, but it does the job.