Solved

Entering text in text box

Posted on 1998-09-08
3
151 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
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 20 total points
Comment Utility
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
Comment Utility
How will I use it, I have placed a control on the dialog box from toolbox.
0
 
LVL 23

Expert Comment

by:chensu
Comment Utility
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 Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Perl Awk Need Help 3 94
no14 challenge 14 56
wordcount challenge 11 72
Making an alias 7 51
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now