-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
This commit is contained in:
Stefan Csomor
2003-08-28 14:49:11 +00:00
parent 9f4a5bc2c7
commit 3a0bd3d5cd
2 changed files with 28 additions and 18 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}
}