void CreateDiscussionGrpDialog::OnTextChanged(TNotifyUI& msg)
{
	if (msg.pSender == m_editSearch)
	{
		m_pListSearchResult->RemoveAll();

		CDuiString inputText = m_editSearch->GetText();
		if (inputText.IsEmpty())
		{
			m_pListSearchResult->SetVisible(false);
			m_pListCreatFrom->SetVisible(true);
		}
		else
		{
			m_pListCreatFrom->SetVisible(false);
			m_pListSearchResult->SetVisible(true);

			module::UserInfoEntityVec userList;
			module::getUserListModule()->getSearchUserNameListByShortName(inputText.GetData(), userList);
			_updateSearchResultList(userList);
		}
	}
}
Ejemplo n.º 2
0
void SearchLayout::Notify(TNotifyUI& msg)
{
	if (msg.pSender == m_edit)
	{
		if (msg.sType == DUI_MSGTYPE_TEXTCHANGED && m_SearchResultList)
		{
			m_SearchResultList->RemoveAll();
			CDuiString inputText = m_edit->GetText();
			if (inputText.IsEmpty())
			{
				SetFixedHeight(30);
				m_SearchResultList->SetVisible(false);
			}
			else
			{
				module::UserInfoEntityVec userList;
				module::getUserListModule()->getSearchUserNameListByShortName(inputText.GetData(), userList);
				_updateSearchResultList(userList,1);

				module::GroupVec gidList;
				module::getGroupListModule()->GetSearchGroupNameListByShortName(inputText.GetData(), gidList);
				_updateSearchResultList(gidList,2);
				if (0 != GetHeight())
				{
					m_SearchResultList->SetVisible(true);
					SetFixedHeight(0);
				}
				m_SearchResultList->ExpandAll();
			}
			//NeedParentUpdate();
		}
	}
	else if (msg.pSender == m_btnSearch && msg.sType == DUI_MSGTYPE_CLICK)
	{
		APP_LOG(LOG_DEBUG, _T("搜索按钮消息"));
		module::getGroupListModule()->onCreateDiscussionGrpDialog();
	}
	else if (msg.sType == DUI_MSGTYPE_ITEMACTIVATE
		&&m_SearchResultList
		&& -1 != m_SearchResultList->GetItemIndex(msg.pSender)
		&& 0 == _tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")))
	{
		Node* node = (Node*)msg.pSender->GetTag();
		if (!m_SearchResultList->CanExpand(node)&& node)
		{
			std::string sid = util::cStringToString(CString(node->data().sId));
			logic::GetLogic()->asynNotifyObserver(module::KEY_SESSION_OPENNEWSESSION, sid);//通知主窗口创建会话
			//m_pManager->SendNotify(this, IM_MSG_DBCLICK_OPENNEWSESSION, WPARAM(sid.c_str()));//通知主窗口创建会话
		}
	}
	else if (msg.sType == DUI_MSGTYPE_ITEMCLICK
		&&m_SearchResultList
		&& -1 != m_SearchResultList->GetItemIndex(msg.pSender)
		&& 0 == _tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")))
	{
		Node* node = (Node*)msg.pSender->GetTag();

		if (m_SearchResultList->CanExpand(node))
		{
			m_SearchResultList->SetChildVisible(node, !node->data().child_visible_);
		}
	}
}