problem with String

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

irado
Just popping in
Just popping in
Posts: 3
Joined: Sat Aug 26, 2006 00:55

problem with String

Postby irado » Sat Aug 26, 2006 01:29

i am try convert the CEGUI::String for the OGRE::String, when i use the line of code:

Code: Select all

movableText->setCaption((Ogre::String&)CEGUI::WindowManager::getSingleton().getWindow((CEGUI::utf8*)"Edit")->getText());


When i put this form one error occur in the execution the program. The function setCaption have how parameters Ogre::String.

When i put Ogre::String or Ogre::String* appear the message when i compile

.\src\AplicacaoListener.cpp(566) : error C2440: 'type cast' : cannot convert from 'const CEGUI::String' to 'Ogre::String *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

i try too the code:

Code: Select all

CEGUI::String tta = CEGUI::WindowManager::getSingleton().getWindow((CEGUI::utf8*)"Edit")->getProperty("Text");
   const char* ttb = tta.c_str();
movableText->setCaption(ttb);


this form one error occour in the execution of program and show the message:

Cannot create D3D9 vertex buffer: Invalid Call
File: ..\src\OgreD3D9HardwareVertexBuffer.cpp
line: 58

User avatar
Levia
Quite a regular
Quite a regular
Posts: 83
Joined: Mon May 22, 2006 18:25
Location: Bergen op zoom, The Netherlands
Contact:

Postby Levia » Sat Aug 26, 2006 07:39

This might work

Code: Select all

movableText->setCaption((Ogre::String)CEGUI::WindowManager::getSingleton().getWindow((CEGUI::utf8*)"Edit")->getText().c_str());

altough

Code: Select all

Ogre::String stringy = CEGUI::WindowManager::getSingleton().getWindow("Edit")->getText().c_str();
movableText->setCaption(stringy);

might be nicer :)
Image
Image

irado
Just popping in
Just popping in
Posts: 3
Joined: Sat Aug 26, 2006 00:55

Postby irado » Sat Aug 26, 2006 13:08

i see the problem, when i use the code:

Code: Select all

Ogre::String stringy = CEGUI::WindowManager::getSingleton().getWindow("Edit")->getText().c_str();
movableText->setCaption(stringy);


the stringy dont receive nothing or in others words, the stringy = "", and when i use the function movableText->setCaption, happen the error because movableText dont show string empty.

why this occour?

User avatar
Levia
Quite a regular
Quite a regular
Posts: 83
Joined: Mon May 22, 2006 18:25
Location: Bergen op zoom, The Netherlands
Contact:

Postby Levia » Sun Aug 27, 2006 08:11

it basically means the window named "Edit" has no text :)
Image

Image

irado
Just popping in
Just popping in
Posts: 3
Joined: Sat Aug 26, 2006 00:55

Postby irado » Sun Aug 27, 2006 13:14

i find the solution for my problem. The problem was the logic the my code, sorry and thanks Levia.

:)

User avatar
Levia
Quite a regular
Quite a regular
Posts: 83
Joined: Mon May 22, 2006 18:25
Location: Bergen op zoom, The Netherlands
Contact:

Postby Levia » Sun Aug 27, 2006 13:36

Glad I could be of any help.
Image

Image


Return to “Help”

Who is online

Users browsing this forum: No registered users and 13 guests