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

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!
greenbirdAsked:
Who is Participating?
 
RONSLOWConnect With a Mentor Commented:
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
 
RONSLOWCommented:
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
 
akalmaniCommented:
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
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
RONSLOWCommented:
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
 
greenbirdAuthor Commented:
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
 
greenbirdAuthor Commented:
Hi,

thanks , i will try it later :)

wish u a happy weekend.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.