Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CEdit in MFC?

Posted on 2009-07-07
6
Medium Priority
?
478 Views
Last Modified: 2013-11-20
Hi all,
I have a dialog, which contains a Edit box. I set the limit text for this edit box is 16. Now I want the first six characters are fixed (I define it  in code for example AAAAAA), and the user can not change it, the 10 characters will be only numbers. Is there any way to do that? Can anyone give me a suggestion?
Thank you very much.
Regards,
0
Comment
Question by:rambovn
[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
  • 3
  • 2
6 Comments
 
LVL 19

Accepted Solution

by:
alb66 earned 1600 total points
ID: 24794188
If you are a VS2008 user you can use the CMFCMaskedEdit class
http://msdn.microsoft.com/en-us/library/bb982230.aspx

Otherwise you can handle the WM_CHAR message and do all the stuff by hand
http://support.microsoft.com/?scid=kb%3Ben-us%3B92394&x=6&y=13
0
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 400 total points
ID: 24794503
Text field (right aligned, caption = AAAAAA) and edit field next to it.  Edit field set to numeric only and 10 char maximum.
0
 
LVL 8

Author Comment

by:rambovn
ID: 24794743
Thank you for all of your help.
Andy: you meant that I create two controls, 1st: text field, and the 2nd is edit field??? But if  I create 2, my dialog looks ugly, because for something like that either there is overlap or there is a small line between them.
abl66: I am using VS2008 but which .h file should I include?

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 8

Author Comment

by:rambovn
ID: 24794769
Andy: now I know what you meant, but it looks not so nice. Is there any way just using one edit field?
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 24795115
>>Is there any way just using one edit field?
Have a look at the comment from alb66
0
 
LVL 8

Author Comment

by:rambovn
ID: 24801583
thanks again for all of your help. I am now using alb66's way.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

670 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