[Quick-x] Moving the parent object of the Cceditbox causes the input box position offset problem

Source: Internet
Author: User

The Cceditbox object is added to a layer, and when the layer moves, the input cursor remains in place in the EditBox input state, which appears to be the cursor offset

If the editbox added at the beginning is not inside the screen, the cursor will appear at the edge of the screen

See this article for a moment

Http://www.cnblogs.com/lan0725/p/3210963.html

The position of the input cursor is called only in SetPosition and OnEnter two methods

In this case, you just need to add a location to the began.

    LocalPointx = -    LocalPointy = -    Local functionEditboxtexteventhandle (Streventname,psender)LocalEdit = Tolua.cast (Psender,"Cceditbox")        ifStreventname = ="began"  Thenedit:setposition (CCP (Pointx, pointy))--default            --Other methods            ElseIfStreventname = ="ended"  Then        End    End    LocalPeditbox = Cceditbox:create (Editboxsize, Ccscale9sprite:create ("Green_edit.png") ) peditbox:setposition (Pointx, pointy) peditbox:setinputmode (keditboxinputmodephonenumber) PEditBox:setFontN Ame ("Arial") Peditbox:setfontsize ( -) Peditbox:setfontcolor (CCC3 (255,0,0)) Peditbox:setplaceholder (1)--Default ValuePeditbox:setplaceholderfontcolor (CCC3 (0,0,255)) Peditbox:setmaxlength (8) Peditbox:setreturntype (kkeyboardreturntypedone)--HandlerPeditbox:registerscripteditboxhandler (Editboxtexteventhandle) layer:addchild (Peditbox)

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.