?
Solved

TMaskEdit with PASSWORDCHAR set to *

Posted on 1998-11-15
7
Medium Priority
?
1,038 Views
Last Modified: 2010-04-04
I am using a TMaskEdit with passwordchar set to * to hide the 5 digits entered by the user. The mask is set to 99999;0;

The problem is that the 5 * are displayed all the time, even when there is no characters in the maskedit. I would like the maskedit to be blank when no character have been entered.
0
Comment
Question by:moonrise
[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
  • 3
7 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 320 total points
ID: 1346933
Use a TEdit instead of a TMaskEdit and write a handler for the OnKeyDown event. In this event discard the key if it is not a digit. If the entered number if 5 digits then discard all further keypresses.

eg:
  if Length(Text) = 5 then
   key := #0
 else
   if not (key in ['0'..'9']) then
     key := #0

Cheers,

Raymond.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1346934
Hello moonrise ;-)

Raymond's code can be simply written as follows

if (Length(Text) = 5 and not (key in ['0'..'9'])) then key := #0

;-)

Cheers,
Viktor
0
 

Author Comment

by:moonrise
ID: 1346935
Thank you both.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:rwilson032697
ID: 1346936
Of course after Viktor compiled it he would change it to:

if (Length(Text) = 5) and not (key in ['0'..'9']) then key := #0

:-)

Cheers,

Raymond.

Thought for the day: Complexity and complication are not the same.

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1346937
Hello jelousy :)

I didn't compile anything... I just know Delphi well ;-)

I haven't opened Delphi for more than a month if you want to know...

btw- Did you compile it to see if it really works, eh?

Cheers,
Viktor
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1346938
Of course I didn't compile it Viktor! That would be taking all the fun out of it!

Raymond.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1346939
Good for you... I just wanted you to know that I didn't compile it also :)
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

719 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