Solved

CEdit in MFC?

Posted on 2009-07-07
6
453 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
  • 3
  • 2
6 Comments
 
LVL 19

Accepted Solution

by:
alb66 earned 400 total points
Comment Utility
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 100 total points
Comment Utility
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
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 8

Author Comment

by:rambovn
Comment Utility
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
Comment Utility
>>Is there any way just using one edit field?
Have a look at the comment from alb66
0
 
LVL 8

Author Comment

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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
GIF file bit manipulation for color change 5 104
Generic progress indicator 6 109
string initialization in java 11 103
wordappend challenge 8 83
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…
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

771 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

13 Experts available now in Live!

Get 1:1 Help Now