?
Solved

Entering text in text box

Posted on 1998-09-08
3
Medium Priority
?
158 Views
Last Modified: 2013-11-20
Hi, I want to enter text, in a text box placed on a dialog, in 2 different ways. I have place buttons on the dialog, like windows phone dialer. I want that if I enter values thru buttons, it should enter the text at the positin where the cursor is blinking. Manual entry is OK in text box but when I press buttons, that's the problem.
Waiting for help...
0
Comment
Question by:Moin
[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
3 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 60 total points
ID: 1321873
Call CEdit::SetSel to remove the current selection and call CEdit::ReplaceSel to insert the text.

CEdit::ReplaceSel
If there is no current selection, the replacement text is inserted at the current cursor location.
0
 

Author Comment

by:Moin
ID: 1321874
How will I use it, I have placed a control on the dialog box from toolbox.
0
 
LVL 23

Expert Comment

by:chensu
ID: 1321875
Use ClassWizard to add a member variable (m_edit) of type CEdit to associate the edit control.

In your button handler,

m_edit.SetSel(-1, 0);
m_edit.ReplaceSel(_T("insert"));
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

777 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