lazarus的InputQuery按以下方法就可以替代密码修改窗口,InputQuery跨平台的,简单方便。
unit unit13; {$mode objfpc}{$H+} interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, SynEdit; type { TForm1 } TForm1 = class(TForm) Button1: TButton; SynEdit1: TSynEdit; procedure Button1Click(Sender: TObject); procedure pp(Sender: TObject; const AValues: array of string; var ACanClose: boolean); private public end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.pp(Sender: TObject; const AValues: array of string; var ACanClose: boolean); begin ACanClose := True; if AValues[0]<>'123' then begin ShowMessage('旧密码不正确'); ACanClose := False; end else if AValues[1]<>AValues[2] then begin ShowMessage('两次密码不同'); ACanClose := False; end; end; procedure TForm1.Button1Click(Sender: TObject); var strResult:array of string; begin SetLength(strResult,3); if InputQuery('密码修改',[chr(9)+'旧 密 码',Chr(9)+'新 密 码',Chr(9)+'确认密码'],strResult,@pp) then begin ShowMessage('新密码:'+strResult[1]); end; end; end.