Solved

Help!!! How to know whether the user has finished writing in edit box?

Posted on 2000-02-25
6
193 Views
Last Modified: 2013-11-20
Hi,

I want the user to enter the name of a file in an edit box, my qn is:

1. how to know the user has finished writing?
2. how to know if the user did not write anything? (for error checking purpose)

Pls help!

Thanks a lot!
0
Comment
Question by:greenbird
  • 3
  • 2
6 Comments
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2560381
1) When the control looses focus (because he has tabbed/moved out to another control, or pressed enter)

2) see if the test is empty.
0
 
LVL 3

Expert Comment

by:akalmani
ID: 2560384
Hi
  Hook a message hanlder for edit box i.e OnKillFocus() , Do all the things there. U can get to know whether the user typed anything or not
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2560394
Best to use DDX_Text to associate a CString member var with the control.  Then add an ON_EN_KILLFOCUS (which would call, say, OnKillfocusEditbox) to the message map.

0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:greenbird
ID: 2560423
Hi, all,

could u pls illustrate more? i am new to VC++, so can not get it, could u pls provide some examples?
such as, the code written in the functions etc.

thanks a lot!
0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 10 total points
ID: 2560442
I assume you have a dialog with an edit box in it.

Go to the dialog edit.

Ctrl+Double Click on the edit control to add a member variable of type CString.

Ctrl+W to bring up the Class Wizard.

Select the ID for your edit control.  Select the kill focus message from the list and add a handler for it, push the edit code button to take you to the code.

This function will be called when the user has finished typing in the control .  Do whatever you want there.  In particular you can look at the CString member variable you created above to see if it is empty (.IsEmpty() function).

That should do it.

If you have problems, try some of the tutorials (like Scribble) that take you through these steps.

Or come back here for some more help.
0
 

Author Comment

by:greenbird
ID: 2560571
Hi,

thanks , i will try it later :)

wish u a happy weekend.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 108
repeateFront java challenge 31 94
fizzArray  challenge 1 96
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 866
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: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.

828 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