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