秋·风

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  278 随笔 :: 0 文章 :: 308 评论 :: 20万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
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.
复制代码
posted on   秋·风  阅读(229)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
点击右上角即可分享
微信分享提示