mirror of https://github.com/axmolengine/axmol.git
Fixed bugs
This commit is contained in:
parent
a788d7cd27
commit
e5b0bbad74
|
@ -326,10 +326,21 @@ void TextField::setTouchSize(const Size &size)
|
|||
|
||||
void TextField::setText(const std::string& text)
|
||||
{
|
||||
if (text.size()==0)
|
||||
return;
|
||||
|
||||
_textFieldRenderer->setString(text);
|
||||
std::string strText(text);
|
||||
if (isMaxLengthEnabled())
|
||||
{
|
||||
strText = strText.substr(0, getMaxLength());
|
||||
}
|
||||
const char* content = strText.c_str();
|
||||
if (isPasswordEnabled())
|
||||
{
|
||||
_textFieldRenderer->setPasswordText(content);
|
||||
_textFieldRenderer->insertText(content, strlen(content));
|
||||
}
|
||||
else
|
||||
{
|
||||
_textFieldRenderer->setString(content);
|
||||
}
|
||||
textfieldRendererScaleChangedWithSize();
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ bool UIListViewTest_Vertical::init()
|
|||
(backgroundSize.width - listView->getSize().width) / 2.0f,
|
||||
(widgetSize.height - backgroundSize.height) / 2.0f +
|
||||
(backgroundSize.height - listView->getSize().height) / 2.0f));
|
||||
listView->addEventListenerScrollView(this, scrollvieweventselector(UIListViewTest_Vertical::selectedItemEvent));
|
||||
listView->addEventListenerListView(this, listvieweventselector(UIListViewTest_Vertical::selectedItemEvent));
|
||||
_uiLayer->addChild(listView);
|
||||
|
||||
|
||||
|
@ -167,22 +167,20 @@ bool UIListViewTest_Vertical::init()
|
|||
return false;
|
||||
}
|
||||
|
||||
void UIListViewTest_Vertical::selectedItemEvent(Object *pSender, ScrollviewEventType type)
|
||||
void UIListViewTest_Vertical::selectedItemEvent(Object *pSender, ListViewEventType type)
|
||||
{
|
||||
/*
|
||||
switch (type)
|
||||
{
|
||||
case SCROLLVIEW_EVENT_SELECT_CHILD:
|
||||
case LISTVIEW_ONSELECTEDITEM:
|
||||
{
|
||||
ListView* listView = static_cast<ListView*>(pSender);
|
||||
CCLOG("select child index = %d", listView->getSelectedChildIndex());
|
||||
CCLOG("select child index = %ld", listView->getCurSelectedIndex());
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// UIListViewTest_Horizontal
|
||||
|
@ -245,7 +243,7 @@ bool UIListViewTest_Horizontal::init()
|
|||
(backgroundSize.width - listView->getSize().width) / 2.0f,
|
||||
(widgetSize.height - backgroundSize.height) / 2.0f +
|
||||
(backgroundSize.height - listView->getSize().height) / 2.0f));
|
||||
listView->addEventListenerScrollView(this, scrollvieweventselector(UIListViewTest_Horizontal::selectedItemEvent));
|
||||
listView->addEventListenerListView(this, listvieweventselector(UIListViewTest_Horizontal::selectedItemEvent));
|
||||
_uiLayer->addChild(listView);
|
||||
|
||||
|
||||
|
@ -342,20 +340,18 @@ bool UIListViewTest_Horizontal::init()
|
|||
return false;
|
||||
}
|
||||
|
||||
void UIListViewTest_Horizontal::selectedItemEvent(Object *pSender, ScrollviewEventType type)
|
||||
void UIListViewTest_Horizontal::selectedItemEvent(Object *pSender, ListViewEventType type)
|
||||
{
|
||||
/*
|
||||
switch (type)
|
||||
{
|
||||
case SCROLLVIEW_EVENT_SELECT_CHILD:
|
||||
case LISTVIEW_ONSELECTEDITEM:
|
||||
{
|
||||
ListView* listView = static_cast<ListView*>(pSender);
|
||||
CCLOG("select child index = %d", listView->getSelectedChildIndex());
|
||||
CCLOG("select child index = %ld", listView->getCurSelectedIndex());
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
UIListViewTest_Vertical();
|
||||
~UIListViewTest_Vertical();
|
||||
bool init();
|
||||
void selectedItemEvent(Object* pSender, ScrollviewEventType type);
|
||||
void selectedItemEvent(Object* pSender, ListViewEventType type);
|
||||
|
||||
protected:
|
||||
UI_SCENE_CREATE_FUNC(UIListViewTest_Vertical)
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
UIListViewTest_Horizontal();
|
||||
~UIListViewTest_Horizontal();
|
||||
bool init();
|
||||
void selectedItemEvent(Object* pSender, ScrollviewEventType type);
|
||||
void selectedItemEvent(Object* pSender, ListViewEventType type);
|
||||
|
||||
protected:
|
||||
UI_SCENE_CREATE_FUNC(UIListViewTest_Horizontal)
|
||||
|
|
Loading…
Reference in New Issue