From effc648f262bd3bd7b57d4e76db2f768510be55c Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 29 Mar 2005 01:22:42 +0000 Subject: Tweaks to Text controls and text handling. --- src/text.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'src/text.cpp') diff --git a/src/text.cpp b/src/text.cpp index ff4241d..4e77387 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -39,6 +39,49 @@ Text::~Text() } +// ------------------------------------------------------------ +// +void Text::OnTextChanged(Window *owner, W32DLibCallback callback) +{ + Control::AddCallback(WM_COMMAND,EN_CHANGE,owner,callback); +} + + +// ------------------------------------------------------------ +// +void Text::MaxLen(int count) +{ + SendMsg(EM_LIMITTEXT,count,0); +} + + +// ------------------------------------------------------------ +// +void Text::ReadOnly(bool readonly) +{ + SendMsg(EM_SETREADONLY,readonly ? TRUE:FALSE,0); +} + + +// ------------------------------------------------------------ +// +void Text::AppendText(const char *text) +{ + int len=GetWindowTextLength(GetHWND()); + SendMsg(EM_SETSEL,len,len); + SendMsg(EM_REPLACESEL,FALSE,reinterpret_cast(text)); +} + + +// ------------------------------------------------------------ +// +void Text::AppendText(const std::string& text) +{ + AppendText(text.c_str()); +} + + + }; // namespace W32DLib // END OF FILE -- cgit v1.2.3