Solved

TMaskEdit with PASSWORDCHAR set to *

Posted on 1998-11-15
7
918 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
  • 3
  • 3
7 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 80 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
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.

 
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

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

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 tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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