// Author: Stefan Csomor
// Modified by: Ryan Norton (MLTE GetLineLength and GetLineText)
// Created: 1998-01-01
-// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
GetTextPeer()->CheckSpelling(check);
}
-void wxTextCtrl::SetMaxLength(unsigned long len)
-{
- m_maxLength = len ;
-}
-
bool wxTextCtrl::SetFont( const wxFont& font )
{
if ( !wxTextCtrlBase::SetFont( font ) )
{
if (CanCopy())
{
- wxClipboardTextEvent evt(wxEVT_COMMAND_TEXT_COPY, GetId());
+ wxClipboardTextEvent evt(wxEVT_TEXT_COPY, GetId());
evt.SetEventObject(this);
if (!GetEventHandler()->ProcessEvent(evt))
{
{
if (CanCut())
{
- wxClipboardTextEvent evt(wxEVT_COMMAND_TEXT_CUT, GetId());
+ wxClipboardTextEvent evt(wxEVT_TEXT_CUT, GetId());
evt.SetEventObject(this);
if (!GetEventHandler()->ProcessEvent(evt))
{
{
if (CanPaste())
{
- wxClipboardTextEvent evt(wxEVT_COMMAND_TEXT_PASTE, GetId());
+ wxClipboardTextEvent evt(wxEVT_TEXT_PASTE, GetId());
evt.SetEventObject(this);
if (!GetEventHandler()->ProcessEvent(evt))
{
void wxTextCtrl::OnKeyDown(wxKeyEvent& event)
{
- if ( event.GetModifiers() == wxMOD_CMD )
+ if ( event.GetModifiers() == wxMOD_CONTROL )
{
switch( event.GetKeyCode() )
{
return ;
}
- // Check if we have reached the max # of chars (if it is set), but still
- // allow navigation and deletion
- GetSelection( &from, &to );
- if ( !IsMultiLine() && m_maxLength && GetValue().length() >= m_maxLength &&
- !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB | WXK_CATEGORY_CUT) &&
- !( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) &&
- from == to )
+ if ( !GetTextPeer()->CanClipMaxLength() )
{
- // eat it, we don't want to add more than allowed # of characters
+ // Check if we have reached the max # of chars (if it is set), but still
+ // allow navigation and deletion
+ GetSelection( &from, &to );
+ if ( !IsMultiLine() && m_maxLength && GetValue().length() >= m_maxLength &&
+ !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB | WXK_CATEGORY_CUT) &&
+ !( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) &&
+ from == to )
+ {
+ // eat it, we don't want to add more than allowed # of characters
- // TODO: generate EVT_TEXT_MAXLEN()
- return;
+ // TODO: generate EVT_TEXT_MAXLEN()
+ return;
+ }
}
// assume that any key not processed yet is going to modify the control
case WXK_RETURN:
if (m_windowStyle & wxTE_PROCESS_ENTER)
{
- wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
+ wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId);
event.SetEventObject( this );
event.SetString( GetValue() );
if ( HandleWindowEvent(event) )
wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
if ( def && def->IsEnabled() )
{
- wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
+ wxCommandEvent event(wxEVT_BUTTON, def->GetId() );
event.SetEventObject(def);
def->Command(event);
key == WXK_DELETE ||
key == WXK_BACK)
{
- wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
+ wxCommandEvent event1(wxEVT_TEXT, m_windowId);
event1.SetEventObject( this );
wxPostEvent( GetEventHandler(), event1 );
}
count = 0;
for (size_t j = i; j < content.length(); j++)
{
- count++;
if (content[j] == '\n')
return count;
+
+ count++;
}
return count;