So I am trying to make a program, which copies the input of an Gtk::Entry and outputs it to the console. However, currently when I enter the first character, nothing happens. Once I enter a second character, the first character gets printed, once I enter a third character, the first 2 characters get printed. When I enter the 4th character, the first 3 get printed. I want it so that when I enter the first character, the first character gets printed, once I enter the second character, the first 2 get printed, and so on.
This is my current inputbox.cpp
#include "inputbox.h"
#include <iostream>
inputBox::inputBox(){
this->signal_key_press_event().connect(sigc::mem_fun(*this, &inputBox::onKeyPress),false);
}
bool inputBox::onKeyPress(GdkEventKey* event){
huidigeInput = get_text();
std::cout << huidigeInput;
set_text("");
return false;
}
and this is my inputbox.h file
class inputBox : public::Gtk::Entry{
public:
inputBox();
bool onKeyPress(GdkEventKey*);
Glib::ustring huidigeInput;
};
I hope someone can find the bug problem!