Page 1 of 1

cegui getText problem

Posted: Thu Dec 07, 2006 21:43
by yuriythebest
I know this is a cegui question but I'l ask it here on account I'l get an answer faster then in the cegui forums. I'm trying to save the text from an edit box (wthe thingy where you inputt the text) into a String.

I have


someString=theEditBox->getText();



and I get

error C2679: binary '=' : no operator found which takes a right-hand operand of type 'const CEGUI::String' (or there is no acceptable conversion)
1> D:\Microsoft Visual Studio 8\VC\include\xstring(875): could be 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator =(const std::basic_string<_Elem,_Traits,_Ax> &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> D:\Microsoft Visual Studio 8\VC\include\xstring(880): or 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator =(const _Elem *)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> D:\Microsoft Visual Studio 8\VC\include\xstring(885): or 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator =(_Elem)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> while trying to match the argument list '(Ogre::String, const CEGUI::String)'




I tried using the stringConverter::tostring bu that didn't help either.

Posted: Thu Dec 07, 2006 21:53
by Rackle
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'const CEGUI::String'
...
while trying to match the argument list '(Ogre::String, const CEGUI::String)'

What the compiler is telling you is that the getText() function (right-hand operand, which returns a CEGUI::String) cannot be assigned (the = operator) into an Ogre::String.

Easiest solution:

CEGUI::String someString=theEditBox->getText();

Posted: Fri Dec 08, 2006 12:51
by yuriythebest
thanks Rackle!