Question

I'm using a IwNUI CTextFieldPtr control and I would like to store/use the text attribute stored on the object in a string variable. I need to use that string but I have no clue on the documentation or examples on how to do it... I don't have a complete code sample either because what I'm asking should be pretty straight forward, such as:

CTextFieldPtr login_tUsername;
//textfield init here
std::string c_username;
login_tUsername->GetAttribute("text", c_username);

Please help me, thank you very much!

Was it helpful?

Solution

And other approach, would be something like this, which is by far much closer to what I wanted to do:

CString value;
login_tUsername->GetAttribute("text", value);
std::string thestring = value.Get();

:)

(Credit goes billarhos billarhos)

OTHER TIPS

Well... the best solution I found for this problem was something like this:

login_tUsername->SetEventHandler("textchanged", this, &OnUserEdit);

bool OnUserEdit(CTextField* textField, const char* text)
{
    c_username = text;
    return true;
}

I don't know why, but it seems you cannot use the textbox text attribute directly.

Cheers!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top