Solved

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

Posted on 2000-02-25
6
190 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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

16 Experts available now in Live!

Get 1:1 Help Now