uselone.pas

来自「中控嵌入式指纹识别开发描述」· PAS 代码 · 共 48 行

PAS
48
字号
unit uSelOne;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TfrmSelOne = class(TForm)
    ListBox1: TListBox;
    Button1: TButton;
    Button2: TButton;
  private
    { Private declarations }
  public
    { Public declarations }
  end;


function SelectItem(Items: tstrings; var Selected: integer): string;

implementation

{$R *.dfm}

function SelectItem(Items: tstrings; var Selected: integer): string;
var
  frmSelOne: TfrmSelOne;
begin
  frmSelOne:= TfrmSelOne.Create(application);
  try
    frmSelOne.ListBox1.Items.Assign(Items);
    if (Selected>=0) and (Selected<frmSelOne.ListBox1.Items.Count) then
      frmSelOne.ListBox1.ItemIndex:=Selected;
    if frmSelOne.ShowModal=mrok then
    begin
      selected := frmSelOne.ListBox1.ItemIndex;
      if selected>=0 then
        result := frmSelOne.ListBox1.Items[selected];
    end;
  finally
    frmSelOne.Free;
  end;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?