#include "AutoScrollEdit.h" #include void AutoScrollEdit::OnFocused( UiWin * pWinPrev ) { // Calc clipped Scrollable Size SIPINFO info; info.cbSize = sizeof(SIPINFO); SipGetInfo(&info); //int SipPanelHeight = info.rcSipRect.bottom - info.rcSipRect.top; int EditorBottom = GetPosY() + GetHeight(); if (info.rcSipRect.top - info.rcVisibleDesktop.top < EditorBottom/* || GetPosY() < 0*/) { // Shrink // ((UiScrollWin*)(GetParent()->GetParent()))->SetPos(0, 0, GetParent()->GetWidth(), GetParent()->GetHeight()*2/3 , SP_NOMOVE); //((UiScrollWin*)(GetParent()))->MoveTopPos(8 - GetPosY()); // first invoke should get ScrollWin parent->SetPos(0, 0, parent->GetParent()->GetWidth(), parent->GetParent()->GetHeight() - (info.rcSipRect.bottom - info.rcSipRect.top) - MZM_HEIGHT_TEXT_TOOLBAR, SP_NOMOVE); //((UiScrollWin*)(GetParent()->GetParent()))->GetParent()->MoveTopPos(8 - GetPosY()); // first invoke should get ScrollWin //((UiScrollWin*)(GetParent()->GetParent()))->Update(); parent->MoveTopPos(8 - GetPosY()); //parent->GetParent()->Update(); parent->Update(); //parent->GetParent()->Update(); } SetCursePos(GetCursePos()); // workaround UiSingleLineEdit::OnFocused(pWinPrev); } void AutoScrollEdit::OnLostFocus( UiWin *pWinNext ) { if (GetParent() == pWinNext || NULL == pWinNext ) { // move to main parent->SetTopPos(0); parent->SetPos(0, 0, GetParent()->GetWidth(), GetParent()->GetParent()->GetHeight() - MZM_HEIGHT_TEXT_TOOLBAR); parent->Update(); } UiSingleLineEdit::OnLostFocus(pWinNext); // inherited }