December 2015
Beginner to intermediate
522 pages
11h 21m
English
In order to implement a text field element successfully, we need to define how it responds to input correctly. Firstly, let's set up a new element type by creating the text field element class and implementing the constructor, as shown here:
GUI_Textfield::GUI_Textfield(const std::string& l_name,
GUI_Interface* l_owner)
: GUI_Element(l_name, GUI_ElementType::Textfield , l_owner){}This element can also have a default text value when loaded, so let's express that by providing a custom version of the ReadIn method:
void GUI_Textfield::ReadIn(std::stringstream& l_stream){
std::string content;
Utils::ReadQuotedString(l_stream, content);
m_visual.m_text.setString(content);
}As you probably know, text fields do not change state if ...
Read now
Unlock full access