cegui getText problem

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

yuriythebest
Just popping in
Just popping in
Posts: 6
Joined: Mon Dec 04, 2006 15:15

cegui getText problem

Postby yuriythebest » Thu Dec 07, 2006 21:43

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.

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Thu Dec 07, 2006 21:53

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();

yuriythebest
Just popping in
Just popping in
Posts: 6
Joined: Mon Dec 04, 2006 15:15

Postby yuriythebest » Fri Dec 08, 2006 12:51

thanks Rackle!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 15 guests