Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Entering text in text box

Posted on 1998-09-08
3
Medium Priority
?
159 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

618 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