In a game of Hangman, a setter of the word/phrase is required to enter a phrase. However, I was wondering if there was any way to input data blindly, so that the guesser cannot see the phrase getting typed in. An example of its use would be passwords being entered.

Recommended Answers

All 6 Replies

example:

edit box ->Object Inspector->Properties->PasswordChar :)

Edit1.PasswordChar:=#42;   {*}
{or}
Edit1.PasswordChar:=#35;   {#}
{or}
Edit1.PasswordChar:='*';
{or}
Edit1.PasswordChar:='x';
{
Use the PasswordChar property to create an edit control that displays a special character in place of any entered text. If PasswordChar is set to the null character (ANSI character zero), the edit control displays its text normally. If PasswordChar is any other character, the edit control displays PasswordChar in place of each character typed. PasswordChar affects the appearance of the edit control only. The value of the Text property reflects the actual characters that are typed.

}

FlamingClaw's example is for using an editbox in a Form application. Are you creating a form or are you doing a consule application?

FlamingClaw's example is for using an editbox in a Form application. Are you creating a form or are you doing a consule application?

console application

program echostar;
uses Crt;
const
  EnterKey = ord(13);
var
  Entry :char;
  SecretMessage :string;
begin
  ClrScr;
  SecretMessage := '';
  Entry := ' ';
  writeln('Enter your secret word or message:');
  repeat
    begin
      Entry := (Readkey);
      write('*');
      if ord(Entry) <> EnterKey then
        SecretMessage := SecretMessage + Entry;
    end;
  until ord(Entry) = EnterKey;
  {display the entry to show it works, then remove}
  writeln;
  writeln('Secret message is ', SecretMessage);
end.

Hi glindhot
I know that my opinion is means nothing,but I like your code.Nice work!

I think that glindhot is solved your problem.Only one thing that you have to to do is download a unit .There are people who rewrote the Turbo Pascal's Crt unit for Delphi.All procedure and function can be found,that working with delphi,such as 'ReadKey','KeyPressed',ClrScr....etc
So try the 'google'...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.