diff options
author | Ian C <ianc@noddybox.co.uk> | 2005-03-29 01:22:42 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2005-03-29 01:22:42 +0000 |
commit | effc648f262bd3bd7b57d4e76db2f768510be55c (patch) | |
tree | d77a2e04e58847a3517649ffa83f86b066de08f6 /src/text.cpp | |
parent | 82f1d860690dc0a2d0210db12344f7ea5e88b6a4 (diff) |
Tweaks to Text controls and text handling.
Diffstat (limited to 'src/text.cpp')
-rw-r--r-- | src/text.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
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<LPARAM>(text)); +} + + +// ------------------------------------------------------------ +// +void Text::AppendText(const std::string& text) +{ + AppendText(text.c_str()); +} + + + }; // namespace W32DLib // END OF FILE |