In my
Start()
function I have:
auto* lineEditUsername = new LineEdit( context_ );
lineEditUsername->SetName( “LineEditUsername” );
lineEditUsername->SetMinHeight( 24 );
window_->AddChild( lineEditUsername );
lineEditUsername->SetStyleAuto();
…
auto* loginButton = new Button( context_ );
loginButton->SetName( “ButtonLogin” );
loginButton->SetMinHeight( 24 );
Text* t = new Text( context_ );
t->SetFont( cache->GetResource< Font >( “Fonts/Anonymous Pro.ttf” ), 15 );
t->SetHorizontalAlignment( HA_CENTER );
t->SetVerticalAlignment( VA_CENTER );
t->SetText( “Login” );
loginButton->AddChild( t );
SubscribeToEvent( loginButton, E_RELEASED, URHO3D_HANDLER( Login, HandleLoginPressed ) );
Then the handler:
void HandleLoginPressed( StringHash eventType, VariantMap& eventData ) {
UIElement* username = window_->GetChild( “LineEditUsername”, true );std::cout << typeid( username ).name() << ’ ’ << username->GetName().CString() << ’ ’ << username << std::endl;
};
This is all based on code from the samples.
My question is how do I get the value of the LineEdit in the handler? I have searched the samples (which never seem to do this), the documentation, and this forum but I can not figure this out.