From 3a0bd3d5cde4c7e91613d28feb450f772213b160 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 28 Aug 2003 14:49:11 +0000 Subject: [PATCH] -1 , -1 for SetSelection improved git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@23273 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/textctrl.cpp | 23 ++++++++++++++--------- src/mac/textctrl.cpp | 23 ++++++++++++++--------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 433e53d165..ae8648962a 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -1173,17 +1173,19 @@ void wxTextCtrl::Remove(long from, long to) void wxTextCtrl::SetSelection(long from, long to) { - if ( from == -1 ) - from = 0; - - if ( to == -1 ) - to = GetLastPosition(); - if ( !m_macUsesTXN ) { ControlEditTextSelectionRec selection ; - selection.selStart = from ; - selection.selEnd = to ; + if ((from == -1) && (to == -1)) + { + selection.selStart = 0 ; + selection.selEnd = 32767 ; + } + else + { + selection.selStart = from ; + selection.selEnd = to ; + } TESetSelect( selection.selStart , selection.selEnd , ((TEHandle) m_macTE) ) ; ::SetControlData((ControlHandle) m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ; @@ -1197,7 +1199,10 @@ void wxTextCtrl::SetSelection(long from, long to) may force a redraw in the text area. */ SetPort((**tpvars).fDrawingEnvironment); /* change the selection */ - TXNSetSelection( (**tpvars).fTXNRec, from, to); + if ((from == -1) && (to == -1)) + TXNSelectAll((TXNObject) m_macTXN); + else + TXNSetSelection( (**tpvars).fTXNRec, from, to); TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart); } } diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index 433e53d165..ae8648962a 100644 --- a/src/mac/textctrl.cpp +++ b/src/mac/textctrl.cpp @@ -1173,17 +1173,19 @@ void wxTextCtrl::Remove(long from, long to) void wxTextCtrl::SetSelection(long from, long to) { - if ( from == -1 ) - from = 0; - - if ( to == -1 ) - to = GetLastPosition(); - if ( !m_macUsesTXN ) { ControlEditTextSelectionRec selection ; - selection.selStart = from ; - selection.selEnd = to ; + if ((from == -1) && (to == -1)) + { + selection.selStart = 0 ; + selection.selEnd = 32767 ; + } + else + { + selection.selStart = from ; + selection.selEnd = to ; + } TESetSelect( selection.selStart , selection.selEnd , ((TEHandle) m_macTE) ) ; ::SetControlData((ControlHandle) m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ; @@ -1197,7 +1199,10 @@ void wxTextCtrl::SetSelection(long from, long to) may force a redraw in the text area. */ SetPort((**tpvars).fDrawingEnvironment); /* change the selection */ - TXNSetSelection( (**tpvars).fTXNRec, from, to); + if ((from == -1) && (to == -1)) + TXNSelectAll((TXNObject) m_macTXN); + else + TXNSetSelection( (**tpvars).fTXNRec, from, to); TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart); } }