UITextField text color always be white

I using cocostudio create UI, text color of UITextField always be white. I must edit the following

    UITextField* vTextF = dynamic_cast(m_pUiLayer->getWidgetByName("textField"));
    UICCTextField* render = dynamic_cast(vTextF->getVirtualRenderer());
    render->setColor(ccc3(0, 0, 0))

is it bug?
p/s:
version of cocos2d-x: 2.2.2
version of cocostudio: 1.2.0.0

yuye liu wrote:

Do not worried. we’ll check out it for u soon. can you give me a demo for you project. you can send me email yuye.liu@chukong-inc.com
Mai Dung wrote:
> I using cocostudio create UI, text color of UITextField always be white. I must edit the following
> […]
> is it bug?
> p/s:
> version of cocos2d-x: 2.2.2
> version of cocostudio: 1.2.0.0

I have sent a email to yuye.liu@chukong-inc.com

I got u email. and We are working on it.

and I want to ask a question. you problem just on wp8 or all platform. and under you project have not cocostudio UI resource. can you send the resource too
yuye liu wrote:

yuye liu wrote:
> Do not worried. we’ll check out it for u soon. can you give me a demo for you project. you can send me email yuye.liu@chukong-inc.com
> Mai Dung wrote:
> > I using cocostudio create UI, text color of UITextField always be white. I must edit the following
> > […]
> > is it bug?
> > p/s:
> > version of cocos2d-x: 2.2.2
> > version of cocostudio: 1.2.0.0

I have a problem when upgrade project from version of cocos2d-x 2.2 to version 2.2.2 with platform wp8 and I also test for android, they get the same results.
I trying to create a new UITextField and set text color by function setcolor(ccc3(0, 0, 0)). If you run my project, type in TextField and text color is black than function setColor(ccc3(0, 0, 0)) working else text color is white that function dose not work

I had fix you problem.

every one can check the demo here:

Error:

textField->setColor(ccc3(0.0f, 0.0f, 0.0f));
textField->setPlaceHolder("input words here");

You want to set the text color but the method “textField~~>setColor);" can not set PlaceHolder’s color.
Correction:
<pre>
textField~~>setColor(ccc3(0.0f, 0.0f, 0.0f));
textField~~>setText;
</pre>
And if you want to set PlaceHolder’s color
you need follow under steps; because our engine had not method to set color for PlaceHolder’s font.
h1.Step1:
In “/Users/UserName/cocos2d-x-2.2.1/extensions/CocoStudio/GUI/UIWidgets/UITextField.cpp”
add code
<pre>
void UITextField::setPlaceHolderWithColor
{
m_pTextFieldRenderer~~>setPlaceHolderWithColor(value, color);
textfieldRendererScaleChangedWithSize();
}
</pre>
below:
<pre>
void UITextField::setPlaceHolder(const char **value)
{
m_pTextFieldRenderer~~>setPlaceHolder;
textfieldRendererScaleChangedWithSize;
}
</pre>
and declare the function In “/Users/UserName/cocos2d-x-2.2.1/extensions/CocoStudio/GUI/UIWidgets/UITextField.h”
<pre>
void setPlaceHolderWithColor;
</pre>
Below:
<pre>
void setPlaceHolder;
</pre>

h1.Step2:
In “/Users/UserName/cocos2d-x-2.2.1/cocos2dx/text_input_node/CCTextFieldTTF.cpp”
<pre>
void CCTextFieldTTF::setPlaceHolderWithColor
{
CC_SAFE_DELETE;
m_pPlaceHolder = ? new std::string : new std::string;
if )
{
CCLabelTTF::setString);
m_ColorSpaceHolder.r = color.r;
m_ColorSpaceHolder.g = color.g;
m_ColorSpaceHolder.b = color.b;
}
}
</pre>
Below:
<pre>
// place holder text property
void CCTextFieldTTF::setPlaceHolder
{
CC_SAFE_DELETE;
m_pPlaceHolder = ? new std::string : new std::string;
if )
{
CCLabelTTF::setString);
}
}
</pre>
and declare the function In “/Users/UserName/cocos2d-x-2.2.1/cocos2dx/text_input_node/CCTextFieldTTF.h”
<pre>
void setPlaceHolderWithColor;
</pre>
Below:
<pre>
void setPlaceHolder;
</pre>
h1.Last Step:
Use
<pre>
textField~~>setPlaceHolderWithColor);
</pre>
to create you UItextField like this way:
<pre>
// Create the UILayer
UILayer**m_pUiLayer = UILayer::create();
m_pUiLayer~~>setPosition;
this~~>addChild(m_pUiLayer);
// Create the textfield
UITextField* textField = UITextField::create();
textField~~>setTouchEnabled;
textField~~>setFontName(”Marker Felt“);
textField~~>setFontSize;
textField~~>setPlaceHolderWithColor(”input words here",ccc3(0.0f, 0.0f, 0.0f));
textField~~>setPosition);
m_pUiLayer~~>addWidget(textField);

Mai Dung wrote: > I have a problem when upgrade project from version of cocos2d-x 2.2 to version 2.2.2 with platform wp8 and I also test for android, they get the same results. > I trying to create a new UITextField and set text color by function setcolor(ccc3(0, 0, 0)). If you run my project, type in TextField and text color is black than function setColor(ccc3(0, 0, 0)) working else text color is white that function dose not work
1 Like

maybe you misunderstood my mind. I want set text input color, not PlaceHolder.
and I used cocos2d-x version 2.2.2

my another workmate test you demo using 2.2.2 version yesterday. it’s same result like my demo.

Mai Dung , you can check it.

and I’m worried about if you really want to set the text input color. but finally you just focus on the PlaceHolder’s color.

Because, in your demo I didn’t find anywhere you set the input text.

just saw you set the PlaceHolder’s test.

so if I misunderstood. I hope you can describe your problem for another way. and I hope I can help you work out the problem in the end as possible as I can.

thank you for your message. Hope you have a good day.

Mai Dung wrote:

maybe you misunderstood my mind. I want set text input color, not PlaceHolder.
and I used cocos2d-x version 2.2.2

I mean the color of characters that you typing from virtual keyboard of device

Does this perform right?

Mai Dung wrote:

I mean the color of characters that you typing from virtual keyboard of device

you just need to change your code like this.

comment the code

textField->setPlaceHolder("input words here");

and add these code

textField->setText("input words here");

You can dwonload the demo here

address:

that’s my problem. but I get incorrect color when I erase and re-type
if you can, please test on android device because I using windows phone and android