/ Published in: Delphi
This program make input type for password.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Edit1: TEdit; procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); private { Private declarations } public { Public declarations } end; var Form1: TForm1; q : string; //str of * w : string; //real str e : longint; implementation {$R *.dfm} procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if Key = #27 then begin AssignFile(output, 'output.txt'); rewrite(output); writeln(output,w); CloseFile(output); end; if Key = #8 then begin if length(w) > 0 then begin SetLength(q,(length(q)-1)); SetLength(w,(Length(w)-1)); Edit1.Text := q; end; end else begin q := q + '*'; Edit1.Text := q; e := Length(w) + 1; SetLength(w,e); w[e] := Char(Key); end; end; procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin Edit1.Text := q; end; end.
URL: www.sa1t.ru