Cocostudio textfiled Text Click Area Stretch by background

Source: Internet
Author: User

I use cocos2dx2.2 version, TextField settouchsize is just a style, click on the input box only click to Text to enter, when the text length is short-sighted, experience poor

Just say the way, no one can read nonsense,

Add ImageView to the area you want to click

EXCHANGETEXTBG = Dynamic_cast<imageview *> (ui->getwidgetbyname ("Reward_exchange_bg_0")); exchangeTextBg- >settouchenabled (True); Exchangetextbg->addtoucheventlistener (This,toucheventselector (RewardExchangePanel :: ONTOUCHEXHCANGETEXTBG));
This is TextField.
Exchangetextfield = Dynamic_cast<textfield *> (ui->getwidgetbyname ("Reward_exchange_text"));

Header file

void Ontouchexhcangetextbg (Ccobject *target,toucheventtype type);

The area touch function allows TextField to call the Attactwithime () function directly.

void Rewardexchangepanel::ontouchexhcangetextbg (Ccobject *target,toucheventtype type) {if (Type! = Toucheventtype:: touch_event_ended) Return;exchangetextfield->attachwithime ();   Exchangetextfield->setcolor (CCC3 (70,155,87));}
I'll never have to tangle with you. Input box click area too small problem, haha

Cocostudio textfiled Text Click Area Stretch by background

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.