bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const Size& dimensions, TextHAlignment alignment, const std::string& fontName, float fontSize)
{
    setDimensions(dimensions.width, dimensions.height);
    setAlignment(alignment, TextVAlignment::CENTER);

    return initWithPlaceHolder(placeholder, fontName, fontSize);
}
Exemple #2
0
TextBox::TextBox(string placeHolderText, float size, string fontName, float width, float height, CCTextAlignment textAlignment, char delimiterChar, int maxNumberOfChars, ccColor3B textColor, ccColor3B placeHolderColor)
{
	// It is not editable
	_is_active = false;

	// Delimiter character
	_delimiter_char = delimiterChar;

	// Init and add place holder text
	initWithPlaceHolder(placeHolderText.c_str(), CCSize(width, height), textAlignment, fontName.c_str(), size);

	// Set empty string, so that place holder is not the string
	setString("");
    
    // Set color
    setColor(textColor);
    
    // Set place holder color
    setColorSpaceHolder(placeHolderColor);
	
	// Default value;
	_pholder_original_color = m_ColorSpaceHolder;
    
    // Maximum number of characters
    _max_chars = maxNumberOfChars;
}