Auto scroll profile viewer when textbox expands, add 20000 character limit

This commit is contained in:
jacob1 2015-07-09 22:50:01 -04:00
parent 906b4a973f
commit 85ce852cbc
3 changed files with 5 additions and 31 deletions

View File

@ -33,7 +33,7 @@ int ScrollPanel::GetScrollLimit()
void ScrollPanel::SetScrollPosition(int position)
{
offsetY = position;
ViewportPosition.Y = position;
ViewportPosition.Y = -position;
}
void ScrollPanel::XOnMouseWheelInside(int localx, int localy, int d)

View File

@ -74,36 +74,6 @@ protected:
virtual void pasteIntoSelection();
};
/*class Textbox : public Component
{
friend class TextboxAction;
protected:
std::string text;
std::string displayText;
int cursor, cursorPosition;
TextboxAction *actionCallback;
bool masked;
bool border;
public:
Textbox(Point position, Point size, std::string textboxText);
virtual ~Textbox();
virtual void SetText(std::string text);
virtual void SetDisplayText(std::string text);
std::string GetText();
void SetActionCallback(TextboxAction * action) { actionCallback = action; }
virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
void SetHidden(bool hidden) { masked = hidden; }
bool GetHidden() { return masked; }
void SetBorder(bool border) {this->border = border;}
void TextPosition();
virtual void Draw(const Point& screenPos);
};
}*/
}

View File

@ -213,6 +213,7 @@ void ProfileActivity::setUserInfo(UserInfo newInfo)
bio = new ui::Textbox(ui::Point(4, currentY), ui::Point(Size.X-12, -1), info.biography);
((ui::Textbox*)bio)->SetInputType(ui::Textbox::Multiline);
((ui::Textbox*)bio)->SetActionCallback(new BioChangedAction(this));
((ui::Textbox*)bio)->SetLimit(20000);
}
else
bio = new ui::Label(ui::Point(4, currentY), ui::Point(Size.X-12, -1), info.biography);
@ -254,7 +255,10 @@ void ProfileActivity::OnTryExit(ExitMethod method)
void ProfileActivity::ResizeArea()
{
int oldSize = scrollPanel->InnerSize.Y;
scrollPanel->InnerSize = ui::Point(Size.X, bio->Position.Y + bio->Size.Y + 10);
if (oldSize+scrollPanel->ViewportPosition.Y == scrollPanel->Size.Y)
scrollPanel->SetScrollPosition(scrollPanel->InnerSize.Y-scrollPanel->Size.Y);
}
ProfileActivity::~ProfileActivity()