DennisWood
asked on
How to select and visible mark a region in an edit field
Hi,
i have a big, multipleline Editfield, with it's controll-membervariable m_EditView, and a value-member-variable m_sView. I wanna search for the sting m_sSearch in the editfield and select it. This works fine if i use some actions like copy, paste, delete, but it isn't visible, not white letters on blue background or something else. If the "selected" text is not in a visible range, the edit-field scrolls by itself to the "selected" text.
Here's the "code" :
void CMyDialog::OnButtonSearch( )
{
UpdateData();
int Pos = m_sView.Find( m_sSearch );
if( Pos >= 0 )
{
m_EditView.SetSel( Pos, Pos + m_sSearch.GetLength() );
}
}
i have a big, multipleline Editfield, with it's controll-membervariable m_EditView, and a value-member-variable m_sView. I wanna search for the sting m_sSearch in the editfield and select it. This works fine if i use some actions like copy, paste, delete, but it isn't visible, not white letters on blue background or something else. If the "selected" text is not in a visible range, the edit-field scrolls by itself to the "selected" text.
Here's the "code" :
void CMyDialog::OnButtonSearch(
{
UpdateData();
int Pos = m_sView.Find( m_sSearch );
if( Pos >= 0 )
{
m_EditView.SetSel( Pos, Pos + m_sSearch.GetLength() );
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.