CCEditBox: problem with 2.1.4 in iOS

Hi,
I’m upgrading from cocos2dx 2.1.1 beta3 to 2.1.4 and I’ve a problem with CCEditBox in iOS. When the textfield has the focus and then there is the keyboard open the textfield isn’t updated with the text I’m inserting. When I close the keyboard the text I’ve inserted appears in the textfield.
I’ve found out that the problem is solved if I add the CCEditBox in the root view of the scene (as in TestCpp), in my app there is another view as dialog and this cause the problem.
Any solution?

Thanks in advance.

Giannandrea

Hi,
another problem I’ve found in CCEditBox in iOS is that if I set the text of the CCEditBox after creation the text is shown only when it gets the focus. This problem is visible also in the TestCpp project adding a call to setText:

    // top
    m_pEditName = CCEditBox::create(editBoxSize, CCScale9Sprite::create("extensions/green_edit.png"));
    m_pEditName->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height*3/4));
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    m_pEditName->setFontName("Paint Boy");
#else
    m_pEditName->setFontName("fonts/Paint Boy.ttf");
#endif
    m_pEditName->setText("Hello world");  // Here is set the text
    m_pEditName->setFontSize(25);
    m_pEditName->setFontColor(ccRED);
    m_pEditName->setPlaceHolder("Name:");
    m_pEditName->setPlaceholderFontColor(ccWHITE);
    m_pEditName->setMaxLength(8);
    m_pEditName->setReturnType(kKeyboardReturnTypeDone);
    m_pEditName->setDelegate(this);
    addChild(m_pEditName);

Giannandrea

Giannandrea Castaldi wrote:

Hi,
I’m upgrading from cocos2dx 2.1.1 beta3 to 2.1.4 and I’ve a problem with CCEditBox in iOS. When the textfield has the focus and then there is the keyboard open the textfield isn’t updated with the text I’m inserting. When I close the keyboard the text I’ve inserted appears in the textfield.
I’ve found out that the problem is solved if I add the CCEditBox in the root view of the scene (as in TestCpp), in my app there is another view as dialog and this cause the problem.
Any solution?
>
Thanks in advance.
>
Giannandrea

Hi !

I have trouble with CCEditBox , I can’t inclure it :frowning: .

Can you tell me how to link to “extension” folder :frowning: .

If I remember correctly for iOS you should have CCEditBox files already included in the XCode project. If you have the error in your files you should verify that in XCode - project - target - Build Settings you have the ‘Header search path’ set correctly (this should be the default):

  • “$(PROJECT_NAME)/libs/cocos2dx/kazmath/include”
  • “$(PROJECT_NAME)/libs/cocos2dx”
  • “$(PROJECT_NAME)/libs/CocosDenshion/include”
  • “$(PROJECT_NAME)/libs/extensions”
  • “$(PROJECT_NAME)/libs/cocos2dx/include”
  • “$(PROJECT_NAME)/libs/cocos2dx/platform/third_party/ios”
  • “$(PROJECT_NAME)/libs/cocos2dx/platform/ios”

Have you the problem for iOS or for another platform?

Giannandrea

Nguyễn Văn Bình wrote:

Hi !
>
I have trouble with CCEditBox , I can’t inclure it :frowning: .
>
Can you tell me how to link to “extension” folder :frowning: .

I code by visual studio 2012 in Windows OS :(.

And when I create new project it can’t include CCEditBox , do you have solution for WinOS ?

Thanks you !

I haven’t used cocos2dx in visual studio but I suppose the use shouldn’t be much different that XCode. Three questions:

  • have you executed the script install-templates-msvc.bat?
  • have you created your project starting from a cocos2dx template?
  • In your project is included the file CCEditBox.cpp?

Giannandrea

Nguyễn Văn Bình wrote:

I code by visual studio 2012 in Windows OS :(.
>
And when I create new project it can’t include CCEditBox , do you have solution for WinOS ?
>
Thanks you !

Giannandrea Castaldi wrote:

I haven’t used cocos2dx in visual studio but I suppose the use shouldn’t be much different that XCode. Three questions:

  • have you executed the script install-templates-msvc.bat?
  • have you created your project starting from a cocos2dx template?
  • In your project is included the file CCEditBox.cpp?
    >
    Giannandrea
    >

No I don’t create project from cocos2d-x template , I don’t know how to do it :frowning: . Can you tell me how to do :frowning:

I create project via " Create new Project " in visual studio .

In the dir where you have cocos2dx (use last version, 2.1.4) you should have the file install-templates-msvc.bat.
You must execute it or by double clicking it or in a command prompt.

Giannandrea

Nguyễn Văn Bình wrote:

Giannandrea Castaldi wrote:
> I haven’t used cocos2dx in visual studio but I suppose the use shouldn’t be much different that XCode. Three questions:
> - have you executed the script install-templates-msvc.bat?
> - have you created your project starting from a cocos2dx template?
> - In your project is included the file CCEditBox.cpp?
>
> Giannandrea
>
>
No I don’t create project from cocos2d-x template , I don’t know how to do it :frowning: . Can you tell me how to do :frowning:
>
I create project via " Create new Project " in visual studio .

Giannandrea Castaldi wrote:

In the dir where you have cocos2dx (use last version, 2.1.4) you should have the file install-templates-msvc.bat.
You must execute it or by double clicking it or in a command prompt.
>
Giannandrea
>

I executed this file and I using 2.1.4
Sorry my English not good .

But I don’t know how to create project starting from a cocos2dx template ?

Can i create project cocos by visual studio ?

This is screenshot when I create new Project . I don’t see anything about libExtension :frowning:

Now that you jave executed the .bat file in Visual Studio you should have the option to create a cocos2dx project: File -> New Project …

Giannandrea

Nguyễn Văn Bình wrote:

Giannandrea Castaldi wrote:
> In the dir where you have cocos2dx (use last version, 2.1.4) you should have the file install-templates-msvc.bat.
> You must execute it or by double clicking it or in a command prompt.
>
> Giannandrea
>
>
I executed this file and I using 2.1.4
Sorry my English not good .
>
But I don’t know how to create project starting from a cocos2dx template ?
>
Can i create project cocos by visual studio ?

I created new Project , and I can’t find to include CCEditBox.h

See my image file :frowning:

I found it , I must include “cocos-ext.h” and using namespace extension to call CCEditBox

Thanks for your reply !

but I don’t know how to use CCEditBox :smiley: .

Can you give me example , Giannadrea :smiley:

Thank you first !