?
Solved

Manipulating the text in an edit control

Posted on 1998-11-11
2
Medium Priority
?
197 Views
Last Modified: 2013-11-20
Using MFC
I have an edit control that I read as the user enters the data.
If the length equal 4 then i take it and and a " - " like so:

void CCompany::OnChangeedtActivePeriod()
{
// TODO: Add your control notification handler code here
int nSize;

UpdateData( TRUE );
nSize = strlen( m_edtActivePeriod );
if( nSize == 4 ){
  CString strBuff;
  strBuff = m_edtActivePeriod + " - ";
  m_edtActivePeriod = strBuff;
  UpdateData( FALSE );
}

}

But when I send it I want the cursor/line to be after the space like so:
User enters: 1998
I take it and add
1998 -
and put it back on the edit control
but want to put the cursor after the space like so:
1998 - |
so the user can enter other data
How do I do that?
Thanks

0
Comment
Question by:eric07
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
wyy_cq earned 100 total points
ID: 1324546
do not use UpdateData(FALSE)
but use

ed=GetDlgItem(IDC_EDIT_ID);// the CWnd point
ed->SetFocus();
ed->SetWindowText(strBuff);
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1324547
Won't the entire text be highlighted?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month8 days, 1 hour left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question