Solved

TMaskEdit with PASSWORDCHAR set to *

Posted on 1998-11-15
7
931 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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 AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

810 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