Solved

TMaskEdit with PASSWORDCHAR set to *

Posted on 1998-11-15
7
911 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 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

21 Experts available now in Live!

Get 1:1 Help Now